判断浏览器信息 js代码。
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312">
<title>JS 判断浏览器</title>
</head>
<body>
<hr>
<!--判断访问者的浏览器(类型)以及版本-->
<script type="text/javascript">
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)
</script>
<hr>
<!--更多有关访问者浏览器(详细信息)-->
<script type="text/javascript">
document.write("<p>Browser: ")
document.write(navigator.appName + "</p>")
document.write("<p>Browserversion: ")
document.write(navigator.appVersion + "</p>")
document.write("<p>Code: ")
document.write(navigator.appCodeName + "</p>")
document.write("<p>Platform: ")
document.write(navigator.platform + "</p>")
document.write("<p>Cookies enabled: ")
document.write(navigator.cookieEnabled + "</p>")
document.write("<p>Browser's user agent header: ")
document.write(navigator.userAgent + "</p>")
</script>
<!--所有信息-->
<script type="text/javascript">
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)
</script>
<hr>
<!--依据浏览器来提示用户-->
<script type="text/javascript">
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!")
}
</script>
</body>
</html>
您可能感兴趣的文章:
js判断浏览器类型与版本号的代码
js判断浏览器版本和类型的二种方法
javascript 判断浏览器版本的代码
检测浏览器版本的js代码
javascript判断浏览器类型与版本的代码