xxxxxxxxxx
function isTouchScreendevice() {
return 'ontouchstart' in window || navigator.maxTouchPoints;
};
if(isTouchScreendevice()){
alert("I am a touch screen device")
}
xxxxxxxxxx
// Works with all 17 of the Chrome Inspector's built-in touch
// devices, as well as my own desktop computer & mobile phone
const isTouchscreen = ('ontouchstart' in window) ||
(navigator.MaxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0)