圆月山庄资源网 Design By www.vgjia.com

复制代码 代码如下:
public static String getBrowser(String userAgent) {
  if(userAgent==null||userAgent.trim().length()<1){
   return "unknow ";
  }
  String[]brorserEN=new String[]{
    "MyIE2",
    "Firefox",
    "KuGooSoft",
    "LBBROWSER",
    "TheWord",
    "QQ",
    "Maxthon",
    "BIDUPlayerBrowser",
    "Opera",
    "Chrome",
    "Safari",
    "9A334",
    "UCWEB",
    "googlebot",
    "rv 11.0"};
  String[]brorserCN=new String[]{
    "MyIE2",
    "Firefox",
    "酷狗",
    "猎豹",
    "世界之窗",
    "QQ",
    "Maxthon",
    "百度影音",
    "Opera",
    "Chrome",
    "Safari",
    "360",
    "UCWEB",
    "googlebot",
    "IE 11.0"};
  for(int i=0;i<brorserEN.length;i++){
   if (userAgent.indexOf(brorserEN[i]) > -1) {
    return brorserCN[i];
   }
  }
  if (userAgent.indexOf("MSIE") > -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";
 }

标签:
判断浏览器版本

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com