Properties of the NAVIGATOR Object

This is the way to display browser characteristics. The object is navigator and here are four of its properties (watch the capitalization) used in the script:

  1. appName returns the name of the browser
  2. appVersion returns the version information of the browser
  3. appCodeName returns code name of the browser. Note: All modern browsers returns "Mozilla", for compatibility reasons.
  4. userAgent returns user-agent header (HTTP) sent by the browser to the server

Knowing information about the browser is important, especially for IF statements, when a designer wants to do an "IF the browser is this, then do this". That is, IF the designer can differientiate the browser information which are chaotically similiar for all browsers!


So, I used this script on each browser:

<div id="demo"></div>
<script>
var txt = "";
txt += "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt += "<p>Browser Name: " + navigator.appName + "</p>";
txt += "<p>Browser Version: " + navigator.appVersion + "</p>";
txt += "<p>User-agent header: " + navigator.userAgent + "</p>";
document.getElementById("demo").innerHTML = txt;
</script>

This is what each browser displayed:

Browser Used appCodeName appName appVersion userAgent
Internet Explorer Mozilla Netscape 5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; CPNTDFJS; GWX:DOWNLOADED; rv:11.0) like Gecko Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; CPNTDFJS; GWX:DOWNLOADED; rv:11.0) like Gecko
Firefox Mozilla Netscape 5.0 (Windows) Mozilla/5.0 (Windows NT 6.3; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
Chrome Mozilla Netscape 5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36 Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36

Chrome indicates itself in both the appVersion and userAgent, while Firefox indicates only in the userAgent. Internet Explorer is very vague in their indentification but they use "like Gecko" at the end of the string. Incidentally, Firefox uses the true Gecko layout engine -- both Chrome and Internet Explorer claim to be like Gecko. Here is a very amusing blog about how this crazy browser-identification came about.

BackTable of ContentsNext