判断浏览器类型

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";
  }

}

posted @ 2019-03-25 19:40  陌上花开缓缓归!  阅读(353)  评论(0编辑  收藏  举报
Top ↑