maxTouchPoints property

The maximum number of simultaneous touch contacts supported by the device.

Note  As of Internet Explorer 11, the Microsoft vendor prefixed version of this property (msMaxTouchPoints) is no longer supported and may be removed in a future release. Instead, use the non-prefixed name, maxTouchPoints, which is better for standards compliance and future compatibility.

This property is read-only.

Syntax

JavaScript
numberPoints = object.maxTouchPoints

Property values

Type: Integer

The maximum number of supported touch points.

Standards information

Remarks

In the case of devices with multiple digitizers (for example, multiple touchscreens), the value must be the maximum of the set of maximum supported contacts by each individual digitizer. For example, suppose a device has 3 touchscreens, which support 2, 5, and 10 simultaneous touch contacts, respectively. The value of maxTouchPoints is 10.

Examples

This example gets the number of touch points on a device. In a Windows Store app using JavaScript, it returns a zero on a mouse only computer, or 1 or more on a touch enabled computer and Windows 8. On earlier versions of Windows, maxTouchPoints returns undefined.


<!DOCTYPE html>
<html>
<head>
      <title>Touch points test</title>
</head>
<body>
  <div id="showme"></div>
  <script>
    var touchpoints = navigator.maxTouchPoints;
    if (touchpoints) {
      document.getElementById("showme").innerHTML = touchpoints.toString();
    } else {
      document.getElementById("showme").innerHTML = "undefined";
    }
 </script>
</body>
</html>


See also

navigator
Windows Store apps using JavaScript Samples: HTML scrolling, panning and zooming sample

 

 

Show:
© 2014 Microsoft