判断浏览器的js代码
JS 判断浏览器
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
document.write("Browser name: "+ browser)
document.write("
")
document.write("Browser version: "+ version)
document.write("
Browser: ")
document.write(navigator.appName + "
")
document.write("
Browserversion: ")
document.write(navigator.appVersion + "
")
document.write("
Code: ")
document.write(navigator.appCodeName + "
")
document.write("
Platform: ")
document.write(navigator.platform + "
")
document.write("
Cookies enabled: ")
document.write(navigator.cookieEnabled + "
")
document.write("
Browser's user agent header: ")
document.write(navigator.userAgent + "
")
var x = navigator
document.write("CodeName=" + x.appCodeName)
document.write("
")
document.write("MinorVersion=" + x.appMinorVersion)
document.write("
")
document.write("Name=" + x.appName)
document.write("
")
document.write("Version=" + x.appVersion)
document.write("
")
document.write("CookieEnabled=" + x.cookieEnabled)
document.write("
")
document.write("CPUClass=" + x.cpuClass)
document.write("
")
document.write("OnLine=" + x.onLine)
document.write("
")
document.write("Platform=" + x.platform)
document.write("
")
document.write("UA=" + x.userAgent)
document.write("
")
document.write("BrowserLanguage=" + x.browserLanguage)
document.write("
")
document.write("SystemLanguage=" + x.systemLanguage)
document.write("
")
document.write("UserLanguage=" + x.userLanguage)
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
if ((browser=="Netscape"||browser=="Microsoft Internet Explorer") && (version>=4))
{
document.write("Your browser is good enough!")
}
else
{
document.write("It's time to upgrade your browser!")
}
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
赞 (0)