JavaScript Navigator Object

The Navigator object specifies information about client’s browser window such as version, mime type and plug-ins. The window.navigator is read only property which gives reference to navigator object which provides information about application running the script. There is no public standard that applies to the navigator object, but all major browsers support it.

JavaScript Navigator Object Syntax


JavaScript Navigator Object Properties

The following are the properties of Navigator object:

  • appName: It specifies name of the browser.
  • appCodeName: It returns code name of the browser.
  • appVersion: It returns version of the browser.
  • language: It indicates default language of the browser.
  • mimeTypes: it is used to return mime types supported by the browser.
  • platform: It indicates the platform in which browser is running.
  • plugins: It indicates plugins that are installed on the browser.
  • userAgent: It specifies user agent header.


The following are the methods of Navigator object:

  • javaEnabled: It indicates whether java is enabled or not. It returns boolean value.
  • taintEnabled: It indicates whether data taint is enabled or not.

JavaScript Navigator Object Example

<!DOCTYPE html>
<meta charset="ISO-8859-1">
<title>JavaScript Navigator</title>
	<script type="text/javascript">
		document.write(navigator.appName + "<br>");
		document.write(navigator.appCodeName + "<br>");
		document.write(navigator.appVersion + "<br>");
		document.write(navigator.cookieEnabled + "<br>");
		document.write(navigator.platform + "<br>");
		document.write(navigator.userAgent + "<br>");
  • <script type=”text/javascript”> tag is used to define client side script which uses attribute type for specifying MIME type.
  • document.write(navigator.appName); line indicates name of the browser.
  • document.write(navigator.appCodeName); line indicates code name of the browser.
  • document.write(navigator.appVersion); line indicates version of the browser.
  • document.write(navigator.cookieEnabled); line indicates if cookies are enabled.
  • document.write(navigator.platform); line indicates the platform in which browser is running.
  • document.write(navigator.userAgent); line indicates user agent header.

JavaScript Navigator Object Demo

  • Save the file as JSnavigator_example.html in your system.
  • Just open the file in the browser, you will see the below picture in the browser.

When the execution process is completed successfully we will get the following output:

JavaScript Navigator Object

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!