The Touch
interface represents a single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad.
The Touch.radiusX
, Touch.radiusY
, and Touch.rotationAngle
describe the area of contact between the user and the screen, the touch area. This can be helpful when dealing with imprecise pointing devices such as fingers. These values are set to describe an ellipse that as closely as possible matches the entire area of contact (such as the user's fingertip). '
Note: Many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force
value will always be 0. This may also be the case for radiusX
and radiusY
; if the hardware reports only a single point, these values will be 1.
Constructor
Touch()
'- Creates a Touch object.
Properties
This interface has no parent, and doesn't inherits or implements any other property.
Basic properties
Touch.identifier
Read only- Returns a unique identifier for this
Touch
object. A given touch point (say, by a finger) will have the same identifier for the duration of its movement around the surface. This lets you ensure that you're tracking the same touch all the time. Touch.screenX
Read only- Returns the X coordinate of the touch point relative to the left edge of the screen.
Touch.screenY
Read only- Returns the Y coordinate of the touch point relative to the top edge of the screen.
Touch.clientX
Read only- Returns the X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
Touch.clientY
Read only- Returns the Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.
Touch.pageX
Read only- Returns the X coordinate of the touch point relative to the left edge of the document. Unlike
clientX
, this value includes the horizontal scroll offset, if any. Touch.pageY
Read only- Returns the Y coordinate of the touch point relative to the top of the document. Unlike
clientY,
this value includes the vertical scroll offset, if any. Touch.target
Read only- Returns the
Element
on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.
Touch area
This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
Touch.radiusX
Read only '- Returns the X radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
screenX
. Touch.radiusY
Read only '- Returns the Y radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as
screenY
. Touch.rotationAngle
Read only '- Returns the angle (in degrees) that the ellipse described by radiusX and radiusY must be rotated, clockwise, to most accurately cover the area of contact between the user and the surface.
Touch.force
Read only '- Returns the amount of pressure being applied to the surface by the user, as a
float
between0.0
(no pressure) and1.0
(maximum pressure).
Methods
This interface has no method and no parent, and doesn't inherits or implements any method.
Specifications
Specification | Status | Comment |
---|---|---|
Touch Events – Level 2The definition of 'Touch' in that specification. | Draft | Added radiusX , radiusY , rotationAngle , force properties, as well as the Touch() constructor.
|
Touch EventsThe definition of 'Touch' in that specification. | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Touch
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Chrome
Full support 48 |
Edge
Full support 79 |
Firefox
Full support 46 |
IE
No support No |
Opera
Full support 35 |
Safari
No support No |
WebView Android
Full support 48 |
Chrome Android
Full support 48 |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 5.0 | |
clientX
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
clientY
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Chrome
Full support Yes |
Edge
Full support ≤79 |
Firefox
Full support Yes |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
identifier
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
pageX
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
pageY
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Chrome
Full support 43 |
Edge
Full support ≤79 |
Firefox
? |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support 43 |
Chrome Android
Full support 43 |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 4.0 | |
Chrome
Full support 43 |
Edge
Full support ≤79 |
Firefox
? |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support 43 |
Chrome Android
Full support 43 |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 4.0 | |
Chrome
Full support 43 |
Edge
Full support ≤79 |
Firefox
? |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support 43 |
Chrome Android
Full support 43 |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 4.0 | |
screenX
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
screenY
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
target
|
Chrome
Full support 22 |
Edge
Full support ≤18 |
Firefox Full support 52 Full support 52 Notes' Touch events support has been fixed and reenabled in Windows desktop platforms. No support 18 — 24 Notes' Web compatibility issues seen in bug 888304. |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 6 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- See implementation notes.'
- See implementation notes.
See also
Touch by Mozilla Contributors is licensed under CC-BY-SA 2.5.