用户代理判断
16lz
2021-01-26
fastclick中的用户代理判断:
windows Phone
/*** Windows Phone 8.1 fakes user agent string to look like Android and iPhone.** @type boolean*/var deviceIsWindowsPhone = navigator.userAgent .indexOf("Windows Phone") >= 0;
Android
/*** Android requires exceptions.** @type boolean*/var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
IOS
/*** iOS requires exceptions.** @type boolean*/var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
IOS4
/*** iOS 4 requires an exception for select elements.** @type boolean*/var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
IOS6~7
/*** iOS 6.0-7.* requires the target element to be manually derived** @type boolean */var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
黑莓
/*** BlackBerry requires exceptions.** @type boolean*/var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
更多相关文章
- Android(安卓)闪光灯
- Application 判断 是否在主进程、主线程
- Android(安卓)cmwap网络方式下使用 webview
- android 上下左右手势判断
- Android(安卓)联网设置
- android 判断真机还是虚拟机的方法汇总
- Android判断主线程
- 大图片文件压缩保存本地,返回本地url
- Android(安卓)可靠判断是不是Debug版本