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:
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 |