【发布时间】:2013-10-06 02:31:01
【问题描述】:
我正在使用这个函数来检测设备是否是触摸设备:
function is_touch_device()
{
return !!('ontouchstart' in window) || !!('onmsgesturechange' in window);
};
从这里获得这个功能:What's the best way to detect a 'touch screen' device using JavaScript?
但是从 Chrome 25 (25.0.1364) 开始,它在我的不是触摸设备的桌面上返回 true。 我也将 IE9 更新为 IE10,它在 IE 中返回 true!
四处搜索,但找不到任何有用的东西来解决这个问题,除了使用类似这样的东西:http://detectmobilebrowsers.com/
你有什么推荐的?
期待您的回复!
【问题讨论】:
标签: javascript touch