Window Navigator
The window.navigator object can be written without the window prefix.
Some examples:
Navigator Cookie Enabled
The property cookieEnabled returns true if cookies are enabled, otherwise false:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"Cookies Enabled is " + navigator.cookieEnabled;
</script>
Try it Yourself
The Browser Names
The properties appName and appCodeName return the name of the browser:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"Name is " + navigator.appName
+ ". Code name is " + navigator.appCodeName;
</script>
Try it Yourself
Did you know?
IE11, Chrome, Firefox, and Safari return appName "Netscape".
Chrome, Firefox, IE, Safari, and Opera all return appCodeName "Mozilla".
The Browser Engine
The property product returns the engine name of the browser:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.product;
</script>
Try it Yourself
The Browser Version I
The property appVersion returns version information about the browser:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.appVersion;
</script>
Try it Yourself
The Browser Version II
The property userAgent also returns version information about the browser:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.userAgent;
</script>
Try it Yourself
Warning !!!
The information from the navigator object can often be misleading, and should not be used to detect browser versions because:
The Browser Platform
The property platform returns the browser platform (operating system):
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.platform;
</script>
Try it Yourself
The Browser Language
The property language returns the browser's language:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.language;
</script>
Try it Yourself
Is Java Enabled?
The method javaEnabled() returns true if Java is enabled:
Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = navigator.javaEnabled();
</script>
Try it Yourself