Last Updated: February 25, 2016
·
479
· calebo

Detect touch devices

function hasTouchScreen() {
    return ('ontouchstart' in window) || 
    window.DocumentTouch && 
    document instanceof DocumentTouch;
}