當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
用javascript判断当前是安卓平台还是ios平台
生活随笔
收集整理的這篇文章主要介紹了
用javascript判断当前是安卓平台还是ios平台
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
通常判斷運行環境都是通過navigator.userAgent
if (/android/gi.test(navigator.userAgent)){
// todo : android
}
if (/ipad|iphone|mac/gi.test(navigator.userAgent)){
// todo : ios
}
} }); </script>
if (/android/gi.test(navigator.userAgent)){
// todo : android
}
if (/ipad|iphone|mac/gi.test(navigator.userAgent)){
// todo : ios
}
?
?
?
<script>
$(function() { var isIOS = (/iphone|ipad/gi).test(navigator.appVersion); if?(isIOS) {} }); </script>
轉載于:https://www.cnblogs.com/hellman/p/4186263.html
總結
以上是生活随笔為你收集整理的用javascript判断当前是安卓平台还是ios平台的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mac升级之后safari打不开网页,怎
- 下一篇: Gradle在IDEA中创建web项目