[英]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.