这是检测器:http ://w3schools.com/js/tryit.asp?filename=try_nav_all
在 Chrome、Firefox、Safari和Netscape 中,它始终显示浏览器代号为 Mozilla,浏览器名称为 Netscape。这不应该根据浏览器而改变吗?
如果您有兴趣,这是代码和不同的输出:
代码:
document.write("Browser CodeName: " + navigator.appCodeName);
document.write("<br /><br />");
document.write("Browser Name: " + navigator.appName);
document.write("<br /><br />");
document.write("Browser Version: " + navigator.appVersion);
document.write("<br /><br />");
document.write("Cookies Enabled: " + navigator.cookieEnabled);
document.write("<br /><br />");
document.write("Platform: " + navigator.platform);
document.write("<br /><br />");
document.write("User-agent header: " + navigator.userAgent);
铬输出:
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Cookies Enabled: true
Platform: Win32
User-agent header: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
火狐输出:
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows; es-ES)
Cookies Enabled: true
Platform: Win32
User-agent header: Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
游猎输出:
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Cookies Enabled: true
Platform: Win32
User-agent header: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
网景输出:
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows; en-US)
Cookies Enabled: true
Platform: Win32
User-agent header: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)