Chrome 29 window.Touch

In the desktop version, chrome 29 "window.Touch" is no longer set to "undefined", this is a problem because I used it to determine if my application is running on a touch device.

Is there an alternative solution?

thanks

+4
source share
2 answers

Yes, use 'ontouchstart' in document.documentElement [source: How to check browser for touchstart support using JS / jQuery? ]

 var isTouchDevice = 'ontouchstart' in document.documentElement; 

or

 if('ontouchstart' in document.documentElement) { //do something with touch stuff } 

More detailed answers and more specific solutions here: What is the best way to detect a touch screen device using JavaScript?

+2
source

Maybe window.Touch.length is the solution to this problem?

-one
source

Source: https://habr.com/ru/post/1499087/


All Articles