Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Basic JavaScript

JS Tutorial JS Syntax JS Variables JS Operators JS If Conditions JS Loops JS Strings JS Numbers JS Functions JS Objects JS Dates JS Arrays JS Sets JS Maps JS Math JS RegExp JS Data Types JS Errors JS Debugging JS Events JS Programming JS References JS UTF-8 Characters JS Versions

JS Advanced

JS Functions JS Objects JS Classes JS Iterations JS Promises JS Modules JS HTML DOM JS Windows JS Web API JS AJAX JS JSON JS jQuery JS Graphics JS Examples JS Reference


JavaScript Window Navigator

The Navigator Object

The navigator object contains information about the visitor's browser.

It can be written with or without the window prefix like:

windows.navigator or just navigator

Browser Cookies

The cookieEnabled property returns true if cookies are enabled, otherwise false:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"cookiesEnabled is " + navigator.cookieEnabled;
</script>
Try it Yourself »

The Browser Language

The language property returns the browser's language:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = navigator.language;
</script>
Try it Yourself »

Is The Browser Online?

The onLine property returns true if the browser is online:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = navigator.onLine;
</script>
Try it Yourself »

Browser Application Name

The appName property returns the application name of the browser:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"navigator.appName is " + navigator.appName;
</script>
Try it Yourself »

Warning

This property is removed (deprecated) in the latest web standard.

Most browsers (Chrome, Edge, Firefox, Safari) returns Netscape as appName.



Browser Application Code Name

The appCodeName property returns the application code name of the browser:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"navigator.appCodeName is " + navigator.appCodeName;
</script>
Try it Yourself »

Warning

This property is removed (deprecated) in the latest web standard.

Most browsers (Chrome, Edge, Firefox, Safari) returns Mozilla as appCodeName.


The Browser Engine

The product property returns the product name of the browser engine:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"navigator.product is " + navigator.product;
</script>
Try it Yourself »

Warning

This property is removed (deprecated) in the latest web standard.

Most browsers returns Gecko as product.


The Browser Version

The appVersion property returns version information about the browser:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = navigator.appVersion;
</script>
Try it Yourself »

Warning

This property is removed (deprecated) in the latest web standard.

Do not rely on appVersion to return the correct browser version.


The Browser Agent

The userAgent property returns the user-agent header sent by the browser to the server:

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.

The navigator object should not be used to detect browser versions because:

  • Different browsers can use the same name
  • The navigator data can be changed by the browser owner
  • Some browsers misidentify themselves to bypass site tests
  • Browsers cannot report new operating systems, released later than the browser

The Browser Platform

The platform property returns the browser platform (operating system):

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = navigator.platform;
</script>
Try it Yourself »

Warning

This property is removed (deprecated) in the latest web standard.

Do not rely on platform to return the correct browser platform in all browsers.


Is Java Enabled?

The javaEnabled() method returns true if Java is enabled:

Example

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = navigator.javaEnabled();
</script>
Try it Yourself »

Warning

This method is removed (deprecated) in the latest web standard.

javaEnabled() always returns false.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.