判断浏览器类型

function GetBrowserType(){

  var userAgent = navigator.userAgent;

  if(userAgent.indexOf("MSIE")>0){

    var b_version = navigator.appVersion;

    var version = b_version.split(";");

    var trim_version = version[1].replace(/[]/g, "");

    if (trim_Version == "MSIE6.0") {
      return "IE6";
    } else if(trim_Version == "MSIE7.0") {
      return "IE7";
    } else if (trim_Version == "MSIE8.0") {
      return "IE8";
    } else if (trim_Version == "MSIE9.0") {
      return "IE9";
    }

 

  }

  if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
    return "Firefox";
  }
  if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
    return "Safari"; //google
  }
  if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
    return "Camino";
  }
  if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
    return "Gecko";
  }

}

上一篇:随机生成UserAgent包之fake-useragent


下一篇:android多媒体框架介绍(四)显示图形系统之hwc叠加器