标签:ret wechat apple case row mac os x web 浏览器 lower
function getAppVersion(){
var browser = {
versions: function () {
var u = navigator.userAgent, app = navigator.appVersion;
var ua = navigator.userAgent.toLowerCase();
return { //移动终端浏览器版本信息
mobile: !!u.match(/AppleWebKit.*Mobile.*/),
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
android: ( u.indexOf(‘Android‘) > -1 || u.indexOf(‘Linux‘) > -1 ? "Android" : false ), //android终端或uc浏览器
iPhone: (u.indexOf(‘iPhone‘) > -1 ? "iPhone" : false ), //是否为iPhone或者QQHD浏览器
wechat: ( ua.match(/MicroMessenger/i) == "micromessenger" ? "micromessenger" : false ),
winPhone: (u.indexOf(‘Windows Phone‘) > -1 ? "winPhone" : false ) //winPhone 手机
};
}(),
language: (navigator.browserLanguage || navigator.language).toLowerCase()
}
if(browser.versions.mobile){
if(browser.versions.wechat){
return "micromessenger";
}
if(browser.versions.android && !browser.versions.wechat){
return "Android" ;
}
if(browser.versions.iPhone && !browser.versions.wechat){
return "iPhone" ;
}
}else{
if(browser.versions.wechat){
return "pcmicromessenger";
}
}
}
标签:ret wechat apple case row mac os x web 浏览器 lower
原文地址:http://www.cnblogs.com/ljbkyBlog/p/7089715.html