如何检测移动设备是否由Google Chrome模拟? [英] How to detect if a mobile device is emulated by Google Chrome?
问题描述
有没有办法区分真正的移动设备和谷歌浏览器模拟的设备?
请注意,Google Chrome可以模拟Useragent,触摸屏,屏幕分辨率和加速度计。
我需要知道一些无法模拟但可以通过javascript检测到的功能。
Is there a way to distinguish a real mobile device from a device emulated by Google Chrome? Please note that Google Chrome can emulate Useragent, touchscreen, screen resolution and accelerometer. I need to know some features which cannot be emulated but can be detected by javascript.
推荐答案
有可能检查navigator.plugins.length。
移动浏览器没有插件,因此navigator.plugins.length等于0;
普通的桌面浏览器有插件,所以我们可以通过插件数组的长度来区分浏览器。
It is possible to check for navigator.plugins.length. Mobile browsers have no plugins, so navigator.plugins.length is equal to 0; Desktop browsers ordinary have plugins, so we can distinguish browsers by length of plugins array.
这篇关于如何检测移动设备是否由Google Chrome模拟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!