判斷瀏覽器類型

function GetBrowserType(){app

  var userAgent = navigator.userAgent;google

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

    var b_version = navigator.appVersion;io

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

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

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

 

  }return

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

}navigator

相關文章
相關標籤/搜索