This article needs a technical review. How you can help.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The InputDeviceCapabilities.firesTouchEvents
read-only property returns a Boolean
that indicates whether the device dispatches touch events.
You can use this property to detect mouse events that represent an action that may already have been handled by touch event handlers. This doesn't necessarily mean the device is a touch screen. For example, stylus and mouse devices typically generate touch events on mobile browsers.
Syntax
var boolean = InputDeviceCapabilities.firesTouchEvents
Returns
A Boolean
Example
myButton.addEventListener('mousedown', function(e) { if (!e.sourceCapabilities.firesTouchEvents) myButton.classList.add("pressed"); });
Specifications
Specification | Status | Comment |
---|---|---|
InputDeviceCapabilities The definition of 'fireTouchEvents' in that specification. |
Editor's Draft | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 47 | ? | ? | ? | ? |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | No support | 47 | ? | ? | ? | ? | ? | 47 |