Check if it's a touch enabled device

23rd November, 2019 1 min. read

A little reminder to myself to detect on a web app it the device is touch enabled or not, no matter the veiwport dimension:

if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
  console.log('is touch enabled')
}

Spotted a typo or (likely) a grammar error? Send a pull request.