当前位置: 编程技术>java/j2ee
通过agent判断浏览器版本救命分享
来源: 互联网 发布时间:2014-10-20
本文导语: 代码如下:public static String getBrowser(String userAgent) { if(userAgent==null||userAgent.trim().length() -1) { if(userAgent.indexOf("MSIE 9.0")>-1){ return "IE 9.0"; }else if(userAgent.indexOf("MSIE 10.0")>-1){ return "IE 10.0"; }else if(userAgent.indexOf("MS...
代码如下:
public static String getBrowser(String userAgent) {
if(userAgent==null||userAgent.trim().length() -1) {
if(userAgent.indexOf("MSIE 9.0")>-1){
return "IE 9.0";
}else if(userAgent.indexOf("MSIE 10.0")>-1){
return "IE 10.0";
}else if(userAgent.indexOf("MSIE 8.0")>-1){
return "IE 8.0";
}else if(userAgent.indexOf("MSIE 7.0")>-1){
return "IE 7.0";
}else if(userAgent.indexOf("MSIE 6.0")>-1){
return "IE 6.0";
}
return "IE";
}
return "unknow Browser";
}