Javascript 如何在internet explorer 11上检测windows 8.1中的触摸屏?
我一直在尝试检测触摸屏在windows 8.1特别是在IE 10/11根据我的项目要求Javascript 如何在internet explorer 11上检测windows 8.1中的触摸屏?,javascript,jquery,Javascript,Jquery,我一直在尝试检测触摸屏在windows 8.1特别是在IE 10/11根据我的项目要求 我试过使用Modernizer.touch,但在IE(触摸屏)上却出现了错误。您可以使用导航器 function is_touch_device() { return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); }
我试过使用Modernizer.touch,但在IE(触摸屏)上却出现了错误。您可以使用
导航器
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!")
}
完整资料来源: