Skip to content

Commit d36fb55

Browse files
author
zhangyonghong
committed
update
1 parent 6baf80d commit d36fb55

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ weekday[new Date(2015, 9, 1).getDay()]; //2015年10月1号
156156

157157
#### 2. Mobile - js
158158

159+
- [js 判断IOS, 安卓](http://caibaojian.com/browser-ios-or-android.html)
160+
```javascript
161+
var u = navigator.userAgent, app = navigator.appVersion;
162+
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
163+
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
164+
alert('是否是Android:'+isAndroid);
165+
alert('是否是iOS:'+isiOS);
166+
```
159167

160168
#### 3. [微信 weixin](http://loo2k.com/blog/detecting-wechat-client/)
161169

0 commit comments

Comments
 (0)