js判断移动端系统
2016-01-19 14:01
417 查看
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" > <meta name="format-detection" content="telephone=no"> <title>Document</title> </head> <body> <script> var isMobile = { Android : function() { return navigator.userAgent.match(/Android/i) ? true : false; }, BlackBerry : function() { return navigator.userAgent.match(/BlackBerry/i) ? true : false; }, iOS : function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false; }, Windows : function() { return navigator.userAgent.match(/IEMobile/i) ? true : false; }, any : function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows()); } }; if (isMobile.iOS()) { alert("apple"); } else { alert("Android"); } </script> </body> </html>
相关文章推荐
- Android如何获取判断是否有悬浮窗权限
- Android中TabLayout使用详解
- iOS开发中总结的小技巧(持续更新中)
- Android SDK Manager 更新代理配置
- Objective-C内存管理
- Android 一个绚丽的loading动效分析与实现!
- 提交APP Store报错信息
- Android之Glide加载图片
- iOS开发之同一个开发证书在多台电脑上使用
- iOS高德地图 初始化 重定义比例尺
- iOS 崩溃日志 Backtrace的符号化
- android 六个主要密度之间的缩放比
- Androidx学习笔记(4)-- 事件处理的四种写法(点击事件为例)
- 一个APK中包含多个dex方法
- 自定义android RadioButton View,添加较为灵活的布局处理方式
- 聊一聊Android 6.0的运行时权限
- android adb install 安装软件常见错误列表解释
- Android播放音频的两种方式
- cocos2dx[3.2](15)——颜色混合BlendFunc
- Android Training - 管理应用的内存