document.createTouch(...) was a legacy factory that creates a Touch object from optional view, target, identifier, and coordinate arguments (MDN). Today it is Deprecated and Non-standard — literacy only.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
unsupported
(or: 1 15 20 / 2 25 30 on a legacy engine)
How It Works
Pick a target element for the synthetic touch.
Guard with feature-detect before calling.
Pass coordinates as in MDN: page then screen pairs.
Read fields like identifier and pageX when supported.
Example 3 — Prefer Modern Input APIs
MDN replacement note: use TouchEvent(); for apps, listen to real events.
JavaScript
// Literacy: do not call createTouch in new apps.
console.log("createTouch deprecated — use TouchEvent() (MDN)");
// Real device input (preferred for products):
window.addEventListener("pointerdown", (e) => {
console.log(e.pointerType, e.clientX, e.clientY);
});
MDN: Document.createTouch() creates and returns a new Touch object configured from optional view, target, identifier, and coordinate parameters.
Yes. MDN marks Document.createTouch() as Deprecated and Non-standard. It is not part of any current specification and is no longer on track to become a standard.
MDN: use the TouchEvent() constructor. For real device input, listen to touch events (or prefer Pointer Events). Do not rely on createTouch() in new apps.
MDN: all parameters are optional. Older extra parameters (clientX, clientY, radiusX, radiusY, rotationAngle, force) should be considered deprecated and not used.
Often no. Chromium removed legacy createTouch / createTouchList support years ago. Always feature-detect typeof document.createTouch === "function" before calling it.
Yes. Both were legacy helpers for building Touch / TouchList objects. Both are deprecated non-standard APIs — learn them only for legacy code and interviews.