Check if it's a touch enabled device

Posted on November 23, 2019

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')
}