firesTouchEvents

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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

Document Tags and Contributors

Tags: 
Contributors to this page: rolfedh, RByers, jpmedley
Last updated by: rolfedh,