js 判断IOS版本号
先来观察 iOS 的 User-Agent 串:
Phone 4.3.2 系统:Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5
iPone 5.1 系统:Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5
iPone 5.1.1 系统:Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5
我们可以从 User-Agent 里发现一些规律:都含有“iPhone”关键词;含有用下划线分隔的系统版本号。嗯,我们可以用这两个规律来分辨出 iOS4 以上的系统。
function gt_ios4() {
// 判断是否 iPhone 或者 iPod
if((navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i))) {
// 判断系统版本号是否大于 4
return Boolean(navigator.userAgent.match(/OS [5-9]_\d[_\d]* like Mac OS X/i));
} else {
return false;
}
}
js 判断IOS版本号的更多相关文章
- javascript 判断IOS版本号
先来观察 iOS 的 User-Agent 串: iPhone 4.3.2 系统: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; ...
- js判断ie版本号
jQuery 2.0 去除了对浏览器版本号的判断(它推荐特性检测),这里是一个老外写的原生判断方法,这段代码着实巧妙!既简介.有向后兼容!一般做法都是:正则搜索 USER_AGENT :但因为历史原 ...
- JS获取IOS版本号
var str= navigator.userAgent.toLowerCase(); var ver=str.match(/cpu iphone os (.*?) like mac os/); if ...
- 判断iOS版本号
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) { }
- JS判断客户端是否是iOS或者Android或者ipad(一)
通过判断浏览器的userAgent,用正则来判断是否是ios和Android客户端.代码如下<script type="text/javascript"> var u ...
- JS判断客户端是否是iOS或者Android或者ipad(三)
* * @function: 判断浏览器类型是否是Safari.Firefox.ie.chrome浏览器 * @return: true或false * */ function isSafa ...
- JS判断客户端是否是iOS或者Android或者ipad(二)
js判断客户端是IPAD和iphone 多了就不说了,直接上代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 funct ...
- JS判断是否是微信页面,判断手机操作系统(ios或android)并跳转到不同下载页面
JS判断客户端是否是iOS或者Android 参考:http://caibaojian.com/browser-ios-or-android.html function is_weixin() { v ...
- js判断手机端操作系统(Andorid/IOS)
非常实用的js判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL = "http://xxx/xxx.apk"; var browser = ...
随机推荐
- Kali2.0VMwareTools安装
安装完系统后,配置好apt源,然后执行下列语句可成功安装VMwareTools工具,可实现本机与虚拟机之间的文件复制等功能: apt-get install open-vm-tools-desktop ...
- [leetcode]Path Sum II
Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals ...
- LeetCode 【Single Number I II III】
Given an array of integers, every element appears twice except for one. Find that single one. 思路: 最经 ...
- [BZOJ 3682]Phorni
后缀平衡树的模板题? I'm so weak…… 现在觉得替罪羊树比 treap 好写,是不是没救了喵- #include <cstdio> #include <cmath> ...
- MSXML应用总结
MSXML的DOM模型是符合W3C DOM标准的,而DOM API在Windows中以COM接口的形式提供,关于COM请大家查阅相关资料.简单来说,COM提供了一个环境和一套规则,使接口的设计实现到对 ...
- C#模拟键盘事件
public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("USER3 ...
- Character类的2个定义大小写方法以及charAt(int index)方法
API文档charAt(int index)是这样定义的: charAt(char index):Returns the char value at the specified index.在指定的索 ...
- [转]js来弹出窗口的详细说明
1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...
- (document).height()、$(document).scrollTop()
(document).height().$(document).scrollTop(),有需要的朋友可以参考下. jQuery(window).height()代表了当前可见区域的大小,而jQuery ...
- SQLite 函数大全
http://blog.sina.com.cn/s/blog_48e2ea3401012031.html