Export (0) Print
Expand All

Building a touch-first site

Build touch-first sites for both Internet Explorer in the new Windows UI and Internet Explorer for the desktop.

This article applies to Internet Explorer 10 and later and affects IE10 standards mode and later.

Starting with Internet Explorer 10 on Windows 8, IE lets users choose from a variety of input devices: touch, pen, and mouse. While the new Windows UI browsing experience is designed for a great touch experience, some customers might prefer the new Windows UI experience when using a mouse and keyboard, while others like the desktop experience when using touch. For more info about touch in Internet Explorer on Windows 8, see Make your site touch-ready.

Use feature detection to determine if the device supports touch. The following example checks for touch capable hardware, which your app can use to present the best experience for the user.


if (window.navigator.maxTouchPoints) {
        // user has touch hardware
    }
    else {
        // user does not have touch hardware
    }


If your app requires a minimum number of touch points, you can test the device for a supported number of points. If your app requires three touch points, you can use the following example that detects if a device supports a minimum of three touch points. For more info on multi-touch across browsers, see Handling Multi-touch and Mouse Input in All Browsers.


    if (window.navigator.maxTouchPoints >= 3) {
        // user has at least three touch points 
    }
    else if (window.navigator.maxTouchPoints) {
        // user has only one or two touch points
    }
    else {
        // user does not have touch hardware
    }


Related topics

Make your site touch-ready

 

 

Show:
© 2014 Microsoft