Last Updated: February 25, 2016
·
513
· calebo

Detect touch devices

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