How to obtain browser information
Window has a navigator object that lets us know all about the browser. We can use a series of API functions to learn about the browser's information.
The JavaScript code is as follows:
function message(){ txt = "<p>浏览器代码名: " + navigator.appCodeName + "</p>"; txt+= "<p>浏览器名称: " + navigator.appName + "</p>"; txt+= "<p>浏览器平台和版本: " + navigator.appVersion + "</p>"; txt+= "<p>是否开启cookie: " + navigator.cookieEnabled + "</p>"; txt+= "<p>操作系统平台: " + navigator.platform + "</p>"; txt+= "<p>User-agent头部值: " + navigator.userAgent + "</p>"; document.getElementById("example").innerHTML=txt; if ((navigator.appName=="Netscape" || navigator.appName=="Microsoft Internet Explorer") && (parseFloat(navigator.appVersion)>=4)){ alert("您的浏览器够先进了!"); } else { alert("是时候升级您的浏览器了!"); } }
We can use this function to inform the user whether the browser should update the browser, but also to help users know the relevant information about the browser
Basic information for each major browser
Landlord test almost current mainstream browser, of course, no matter how many browsers are trident,blink,gecko,webkit of these kinds of browser kernel, parsing will not have too much access, is attached to the relevant screenshots are as follows:
This is the edge.
IE11, the landlord did not use IE6, but should not have too much discrepancy
Safari, the landlord is Window System Safari version is relatively low
Sogou Browser, once the landlord has also been infatuated with it for some time!
QQ Browser (micro-letter version), compared to the force, now the landlord in addition to chrome with the most browsers, dual-core Trident and Blink,chrome core under the fast
360 Secure browser compatibility mode, with IE's Trident kernel
Firefox, not much said, Netscape genuine, developers must browser
Chrome. Now the most used by the landlord browser, Google is really good, the force is very
360 Secure browser speed mode, chrome core, fast
Code Result analysis