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 ("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");
This article is from the "Small blog" blog, be sure to keep this source http://9686567.blog.51cto.com/9676567/1605931
Java JSP gets the request header to determine what browser