Detecting iOS
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;
iOS
will be either true
or false
Why not MSStream
Microsoft injected the word iPhone in IE11's userAgent
in 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
Detecting iOS的更多相关文章
- phonegap + xcode5.0.2 配置开发环境
phonegap官网: http://phonegap.com/ 第一部:安装nodejs 安装地址:http://nodejs.org/ 安装phoneGap 官网下载http://phonega ...
- Mac安装PhoneGap3
Mac安装PhoneGap3第一步需要安装NodeJS,在Mac下有一个.pkg安装包(Mac OS X Installer (.pkg),下载下来一路点击就可以安装成功了.在Terminal控制台输 ...
- JavaScript_JS判断客户端是否是iOS或者Android
通过判断浏览器的userAgent,用正则来判断是否是ios和Android客户端.代码如下: <script type="text/javascript"> var ...
- IOS开发--UI进阶之iCarousel学习(待翻译)
前言:先展示这个会被多个项目用到的开源的轮播器的其中一个动画效果: 更多的效果请到github原网址查看:https://github.com/nicklockwood/iCarousel 源码也可以 ...
- ios上uiwebview的一些实用技巧
前几个星期接到公司一个项目,要用webview在客户端上播视频,作为一个前端实习生,这种需求真是蛋疼……一不知webview是何方神圣,二不知咋调试…… 下面就是蛋疼的开始: 寻找调试工具:好,非w ...
- 【IOS笔记】Event Delivery: The Responder Chain
Event Delivery: The Responder Chain 事件分发--响应链 When you design your app, it’s likely that you want t ...
- iOS 解析手势识别(Gesture Recognizers)
一.Gesture Recognizers Gesture Recognizers是在iOS3.2引入的,可以用来识别手势.简化定制视图事件处理的对象.Gesture Recognizers的基类为U ...
- IOS 逆向工程之砸壳
在<iOS应用逆向工程>4.6.2节中,我们曾推荐使用iPhoneCake源的AppCrackr 1.7版给App砸壳.这种方式简单粗暴,省时省力,但正是因为它过于方便有木有,导致几乎所有 ...
- [转]About the security content of iOS 8
Source:http://support.apple.com/kb/HT6441 For the protection of our customers, Apple does not disclo ...
随机推荐
- 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "XXXView" nib but the view outlet was not set.' 崩溃问题
先说下我遇到这个崩溃问题的原因: 自定义的Viewxib和系统的 View重名,导致崩溃 我的理解是我这里加载YJLoginViewController 的时候,YJLoginViewControll ...
- bootstrap Table的 一些小操作
function HQCreatTable(ob) { var option = { cache: false,//是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) scroll ...
- GitLab-CE-8.9.4 (OpenLogic CentOS 7.2)
平台: CentOS 类型: 虚拟机镜像 软件包: gitlab-8.9.4 bug tracking collaboration commercial development devops git ...
- window7防火墙无法更改某些设置,错误代码0×80070422
原因:这是由于管理工具的服务中的windows防火墙被禁用了. 解决方案:在window7中点击控制面板,然后点击管理工具,在点服务,然后找到windows firewall 然后将其改为自动就就可以 ...
- Unix系统中常用的信号含义
http://blog.csdn.net/u012349696/article/details/50687462 编号为1 ~ 31的信号为传统UNIX支持的信号,是不可靠信号(非实时的),编号为32 ...
- iOS 提交form表单,上传图片
之前不会用,总感觉很难,用后感觉不是太难,本文只是简单的讲一下怎么使用的, //实例话对象 AFHTTPSessionManager *manager = [AFHTTPSessionManager ...
- Python求包含数字或字母最长的字符串及长度
一.求包含数字或字母最长的字符串及长度 org = 'ss121*2222&sdfs2!aaabb' result = [] #保存最终要输出的字符串 result_temp = [] #保存 ...
- Python判断一个数是否为小数
一.判断一个数是否为小数 1.有且仅有一个小数点 2.小数点的左边可能为正数或负数 3.小数点的右边为正数 二.实现代码 def is_float(str): if str.count('.') == ...
- 洛谷P3374树状数组1
下有彩蛋(from https://www.cnblogs.com/wuwangchuxin0924/p/5921130.html)树状数组的blog写的最好的是这位//https://www.cnb ...
- 【前端_js】解决ajax跨域请求数据
1.ajax发送请求必须遵循同源策略,即请求方和相应方的协议头.域名.端口全部一样.只要三者有一个不一样都视为跨域,浏览器出于安全考虑不允许跨域访问. 解决ajax跨域访问的常用方法: a.使用jso ...