热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

js判断苹果机安卓机

判断varbrowser{versions:function(){varunavigator.userAgent,appnavigator.appVersion;return{移动

//判断var browser = {versions: function () {var u = navigator.userAgent, app = navigator.appVersion;return { // 移动终端浏览器版本信息trident: u.indexOf('Trident') > -1, //IE内核presto: u.indexOf('Presto') > -1, //opera内核webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器iPad: u.indexOf('iPad') > -1, //是否iPadwebApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部
};}(),language: (navigator.browserLanguage || navigator.language).toLowerCase()};var isIphone = /iPhone|iPad|iPod/i.test(navigator.userAgent);alert(isIphone);alert(browser.versions.webApp);

 

转:https://www.cnblogs.com/shimily/articles/5306574.html



推荐阅读
author-avatar
mobiledu2502860153
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有