---
title: Javascript Navigator
description: "> The `window.navigator` object contains information about the visitor’s browser. ## Window Navigator The `window.navigator` object can be written without the window prefix. Some examples: - `navigator.appName` - `navigator.appCodeName` - `navigator.platform` --- ##   ## Browser Cookies The `cookieEnabled` property returns true if cookies are enabled,…"
url: "https://apprentice.mn/docs/javascript-navigator/"
updated: "2021-05-19"
category: Javascript
---

# Javascript Navigator

> The `window.navigator` object contains information about the visitor’s browser.

## Window Navigator

The `window.navigator` object can be written without the window prefix.

Some examples:

- `navigator.appName`
- `navigator.appCodeName`
- `navigator.platform`

---

##  

## 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>`

## 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>`

## 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>`

“Mozilla” is the application code name for both Chrome, Firefox, IE, Safari, and Opera.

---

##  

## 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>`

Do not rely on this. Most browsers returns “Gecko” as product name !!

---

##  

## 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>`

##  

## 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>`

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

## Warning !!!

The information from the navigator object can often be misleading, and 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>`

## The Browser Language

The `language` property returns the browser’s language:

### Example

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

<script>
document.getElementById("demo").innerHTML = navigator.language;
</script>`

## 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>`

## Is Java Enabled?

The `javaEnabled()` method returns true if [Java](https://www.w3schools.com/java/default.asp) is enabled:

### Example

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

<script>
document.getElementById("demo").innerHTML = navigator.javaEnabled();
</script>`        [https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator)[https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator](https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator)[https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator](https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fjavascript-navigator%2F&linkname=Javascript%20Navigator)[https://www.addtoany.com/share](https://www.addtoany.com/share)
