Detecting iOS
2015-09-15 11:27
465 查看
Detecting iOS
I am not a fan of User Agent sniffing, but here is how you would do it:var iOS = /iPad|iPhone|iPod/.test(navigator.platform);
Another way, relying on the
userAgent:
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
iOSwill be either
trueor
false
Why not MSStream
Microsoft injected the word iPhone in IE11'suserAgentin order to try and fool Gmail somehow. Therefore we need to exclude it. More info about this here and here.
Below is IE11's updated
userAgent(Internet Explorer for Windows Phone 8.1 Update):
Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537
相关文章推荐
- IOS各种编译问题
- IOS 中NSUserDefaults的用法(轻量级本地数据存储)
- iOSCoreAnimation动画系列教程(一):CABasicAnimation【包会】
- iOS 表格视图与CoreData配合使用 点击后被点击的cell消失问题
- IOS TableView的Delegate Methods-tableView didSelectRowAtIndexPath
- iOS设定指定文字颜色为红色
- [iOS实战进阶]iOS开发完毕,提测时如何发包
- iOS开发如何在外面拿到一个子控件的frame ????
- iOS 技术分享2
- iOS后台定位实现
- iOS开发-清理缓存功能的实现
- IOS学习之ios全局变量定义和使用
- ios顶部状态栏
- 蓝懿iOS培训日志12 成绩单需求和小party
- SMS_SDK短信验证 官方的新版本的获取验证码方法已经修改
- iOS 禁止横屏
- 【iOS】OC与JS交互 网页中调用JS与JS注入
- Cordova for iOS —— 创建Cordova工程
- iOS界面设计切图小结
- IOS中的音频视频处理