ontouchstart存在于非触摸设备上的窗口对象中

时间:2017-10-24 18:21:27

标签: javascript html windows-10

我在使用Chrome浏览器,IE浏览器,Edge或Mozilla的任何浏览器中没有触摸屏的普通台式电脑时遇到问题我看到窗口对象有 ontouchstart < / em>财产。这仅在Windows版本1607(周年纪念更新)上发生,并且不会在任何其他版本的Windows 10上发生。

我问,因为在我的代码中我曾经检测过它是否按照以下代码触摸屏

var isTouchScreen = !! ( ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch || (navigator && navigator.maxTouchPoints));

但现在在Windows 1607中,即使我在没有触摸屏的桌面PC上工作,这个变量总是返回TRUE,这会破坏我代码中的大量逻辑。

有人知道该特定Windows版本有什么问题吗?

0 个答案:

没有答案