JavaScript Tutorial

BOM Navigator (Window Navigator)

The window.navigator object holds information about the user's browser.

Window Navigator

The window.navigator object can be used without the window prefix.

Some below examples to get the browser details:

  • navigator.appName
  • navigator.appCodeName
  • navigator.platform

Browser Cookies

The cookieEnabled property returns true if cookies are enabled in the browser, otherwise return false:

Input:-

Output :-

Browser Application Name

The appName property is used to return the application name of the browser:

Input:-

Output :-

Note:- Strange enough, "Netscape" is the application name for all IE11, Chrome, Firefox, and Safari.

Browser Application Code Name

The appCodeName property is used to return the application code name of the browser:

Input:-

Output :-

Note:- "Mozilla" is the application code name for both Chrome, Firefox, IE, Safari, and Opera.

Browser Engine

The product property used to return the product name of the browser engine:

Input:-

Output :-

Note:- Do not rely on this. Most browsers return "Gecko" as the product name !!

Browser Version

The appVersion property is used to return version information about the browser:

Input:-

Output :-

Browser Agent

The userAgent property is used to return the user-agent header sent by the browser to the server:

Input:-

Output :-

Warning !!!

The information from the navigator object can often be misleading, and should not be used to detect browser versions because:

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

The Browser Platform

The platform property used to return the browser platform (OS – operating system):

Input:-

Output :-

Browser Language

The language property is used to return the browser's language:

Input:-

Output :-

Is Browser Online?

The onLine property is used to return the browser status. If it is online then will return true:

Input:-

Output :-

Is Java Enabled?

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

Input:-

Output :-


Go back to Previous Course