如何获取浏览器信息
Window有navigator对象让我们得知浏览器的全部信息.我们可以利用一系列的API函数得知浏览器的信息.
JavaScript代码如下:复制代码 代码如下:function message(){ txt = "
浏览器代码名: " + navigator.appCodeName + "
"; txt+= "
浏览器名称: " + navigator.appName + "
"; txt+= "
浏览器平台和版本: " + navigator.appVersion + "
"; txt+= "
是否开启cookie: " + navigator.cookieEnabled + "
"; txt+= "
操作系统平台: " + navigator.platform + "
"; txt+= "
User-agent头部值: " + navigator.userAgent + "
"; document.getElementById("example").innerHTML=txt; if ((navigator.appName=="Netscape" || navigator.appName=="Microsoft Internet Explorer") && (parseFloat(navigator.appVersion)>=4)){ alert("您的浏览器够先进了!"); } else { alert("是时候升级您的浏览器了!"); } }
以上就是JavaScript获取各大浏览器信息图示的详细内容,更多请关注本站其它相关文章!