简体   繁体   English

如何在Internet Explorer 11上的Windows 8.1中检测触摸屏?

[英]How to detect touch screen in windows 8.1 on internet explorer 11?

I have been trying to detect touch screen in windows 8.1 specially on IE 10/11 as per my project requirement... 我一直在尝试根据我的项目要求特别是在IE 10/11上检测Windows 8.1中的触摸屏...

I have tried with Modernizer.touch but its getting false on IE (touch screen). 我已经尝试过Modernizer.touch,但在IE(触摸屏)上却越来越虚假。

You can use navigator ? 您可以使用navigator吗?

function is_touch_device() {
 return (('ontouchstart' in window)
      || (navigator.MaxTouchPoints > 0)
      || (navigator.msMaxTouchPoints > 0));
}

if (is_touch_device()) {
   alert("Yay! Its touch");
}else{
   alert("Not touch!") 
}

Full source: http://ctrlq.org/code/19616-detect-touch-screen-javascript 全文: http : //ctrlq.org/code/19616-detect-touch-screen-javascript

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检测 Internet Explorer 11 及以下版本? - How to detect Internet Explorer 11 and below versions? 如何区分Internet Explorer 10 / Windows Phone 8中的单击和触摸事件 - How to distinguish click and touch events in Internet Explorer 10 / Windows Phone 8 Internet Explorer 11是否支持Multi-Touch? - Does Internet Explorer 11 support Multi-Touch? 绑定触摸事件并避免在Internet Explorer中滚动(11) - Bind touch events and avoid scrolling in Internet Explorer (11) 诺基亚此处映射Javascript错误(带触摸屏的Internet Explorer) - Nokia Here maps Javascript error (Internet Explorer with touch screen) 是否可以使用脚本检测完整的Internet Explorer 11构建版本? - Is it possible to detect full Internet Explorer 11 build version using a script? 如何在Internet Explorer 11中获取RadioNodeList值? - How to get RadioNodeList value in Internet Explorer 11? 如何为 Internet Explorer 11 配置编译器选项 - how to configure compiler option for internet explorer 11 Windows Phone Internet Explorer Mobile 7浏览器是否支持触摸事件? - Does the Windows Phone Internet Explorer Mobile 7 browser support touch events? 由于脚本错误,Internet Explorer 11上出现黑屏 - Blank screen on internet explorer 11 due to script error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM