标签:iphone android function windows 浏览器
1.js:function sourceDevice(){
var ua = navigator.userAgent.toLowerCase();
if(ua.indexOf("iphone") != -1){
return IPHONE;
}else if(ua.indexOf("android") != -1){
return ANDROID;
}else if(ua.indexOf("ipad") != -1){
return IPAD;
}else if(ua.indexOf("windows nt") != -1){
return PC;
}else{
return OTHERDEVICE;
}
}
function sourceBrow(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return WEIXIN;
}else if (ua.indexOf("ucbrowser") != -1){
return UC;
}else if(ua.indexOf("360 aphone browser") != -1){
return THREESIXZERO;
}else if(ua.indexOf("safari") != -1){
if(sourceType == 1){
return SAFARI;
}
return OTHERBROW;
}else{
return OTHERBROW;
}
}
2.java
String header=request.getHeader("user-agent");
本文出自 “小博客” 博客,请务必保留此出处http://9686567.blog.51cto.com/9676567/1605931
标签:iphone android function windows 浏览器
原文地址:http://9686567.blog.51cto.com/9676567/1605931