function isTouchScreendevice() { return 'ontouchstart' in window || navigator.maxTouchPoints; }; if(isTouchScreendevice()){ alert("I am a touch screen device") }