- JavaScript Basics
- JavaScript Home
- JavaScript Syntax
- JavaScript Placements
- JavaScript Output
- JavaScript Statements
- JavaScript Keywords
- JavaScript Comments
- JavaScript Variables
- JavaScript var
- JavaScript let
- JavaScript const
- JavaScript var Vs let Vs const
- JavaScript Operators
- JavaScript Comparison/Logical
- JavaScript Data Types
- JS Conditional Statements
- JavaScript Conditional Statement
- JavaScript if Statement
- JavaScript if-else Statement
- JavaScript switch Statement
- JavaScript Loops
- JavaScript for Loop
- JavaScript while Loop
- JavaScript do-while Loop
- JavaScript Break Continue
- JavaScript Popup Boxes
- JavaScript Dialog Box
- JavaScript alert Box
- JavaScript confirm Box
- JavaScript prompt Box
- JavaScript Functions
- JavaScript Functions
- JS Function with Parameter
- JavaScript Return Statement
- JavaScript Variable Scope
- JavaScript setTimeout() Method
- JavaScript setInterval() Method
- JavaScript Events
- JavaScript Events
- JavaScript onclick Event
- JavaScript onload Event
- JavaScript Mouse Events
- JavaScript onreset Event
- JavaScript onsubmit Event
- JavaScript Objects
- JavaScript Objects
- JavaScript Number Object
- JavaScript Array Object
- JavaScript String Object
- JavaScript Boolean Object
- JavaScript Math Object
- JavaScript RegExp Object
- JavaScript Date Object
- JavaScript Browser Objects
- JavaScript Browser Objects
- JavaScript Window Object
- JavaScript Navigator Object
- JavaScript History Object
- JavaScript Screen Object
- JavaScript Location Object
- JavaScript Document Object
- JS Document Object Collection
- JS Document Object Properties
- JS Document Object Methods
- JS Document Object with Forms
- JavaScript DOM
- JavaScript DOM
- JavaScript DOM Nodes
- JavaScript DOM Levels
- JavaScript DOM Interfaces
- JavaScript Cookies
- JavaScript Cookies
- JavaScript Create/Delete Cookies
- JavaScript Advance
- JavaScript Regular Expression
- JavaScript Page Redirection
- JavaScript Form Validation
- JavaScript Validations
- JavaScript Error Handling
- JavaScript Exception Handling
- JavaScript try-catch throw finally
- JavaScript onerror Event
- JavaScript Multimedia
- JavaScript Animation
- JavaScript Image Map
- JavaScript Debugging
- JavaScript Browser Detection
- JavaScript Security
- JavaScript Misc
- JavaScript innerHTML
- JavaScript getElementById()
- JS getElementsByClassName()
- JS getElementsByName()
- JS getElementsByTagName()
- JavaScript querySelector()
- JavaScript querySelectorAll()
- JavaScript document.write()
- JavaScript console.log()
- JavaScript Programs
- JavaScript Programs
- JavaScript Test
- JavaScript Online Test
- Give Online Test
- All Test List
JavaScript Navigator Object
The navigator object in JavaScript is used to display information about the version and type of the browser.
The navigator object in JavaScript has the following three features:
- Collections
- Properties
- Methods
JavaScript Navigator Object Collections
The table given below describes the collections of the navigator object in JavaScript.
Collection | Description |
---|---|
plugins[] | returns a reference to all the embedded objects in the document |
mimeTypes | returns a collection of MIME types supported by client browser |
JavaScript Navigator Object Properties
The navigator object in JavaScript is used to retrieve properties of client browser. The following table describes properties of the navigator object in JavaScript.
Property | Description |
---|---|
appcodename | specifies the code name of the browser |
appname | specifies the name of the browser |
appversion | specifies the version of the browser being used |
cookieenabled | specifies whether the cookies are enabled or not in the browser |
platform | contains a string indicating the machine type for which the browser was compiled |
useragent | contains a string representing the value of the user-agent header sent by the client for the server in the http protocol |
JavaScript Navigator Object Properties Example
Here is an example demonstrates navigator object properties in JavaScript:
<!DOCTYPE HTML> <html> <head> <title>JavaScript Navigator Object Properties</title> <script type="text/javascript"> function dispNavigatorProperties() { with(document) { write("<b>appName = </b>") writeln(navigator.appName + "<br/><br/>") write("<b>appVersion = </b>") writeln(navigator.appVersion + "<br/><br/>") write("<b>appCodeName = </b>") writeln(navigator.appCodeName + "<br/><br/>") write("<b>platform = </b>") writeln(navigator.platform + " <br/><br/>") write("<b>userAgent = </b>") writeln(navigator.userAgent + "<br/><br/>") } } function dispExplorerProperties() { with(document) { write("<b>appName = </b>") writeln(navigator.appName + "<br/><br/>") write("<b>appVersion = </b>") writeln(navigator.appVersion + "<br/><br/>") write("<b>appCodeName = </b>") writeln(navigator.appCodeName + "<br/><br/>") write("<b>platform = </b>") writeln(navigator.platform + " <br/><br/>") write("<b>userAgent = </b>") writeln(navigator.userAgent + "<br/><br/>") write("<b>cookieEnabled = </b>") writeln(navigator.cookieEnabled + "<br/><br/>") } } function dispBrowserProperties() { if(navigator.appName == "Netscape") dispNavigatorProperties() else if(navigator.appName == "Microsoft Internet Explorer") dispExplorerProperties() } dispBrowserProperties() </script> </head> <body> </body> </html>
Here are some outputs of the above JavaScript navigator object properties example code. This is the snapshot of output produced in Google Chrome browser:

Here is the output produced in Mozilla Firefox browser:

Here is the output produced in Safari browser:

Here is the output produced in Microsoft Internet Explorer browser:

JavaScript Navigator Object Methods
The methods in the navigator object specify the action related to the browser. The table given below describes the methods of the navigator object in JavaScript.
Method | Description |
---|---|
javaEnabled() | tests whether Java is enabled or not |
taintEnabled() | determines whether data tainting is enabled or not |
Tainting prevents other scripts from passing information that should be secure and private, such as directory structures or suer session history
JavaScript Navigator Object Methods Example
Here is an example demonstrates navigator object methods in JavaScript:
<!DOCTYPE HTML> <html> <head> <title>JavaScript Navigator Object Methods</title> </head> <body> <h3>JavaScript Navigator Object Methods Example</h3> <script type="text/javascript"> document.write("<b>Java enabled: </b>" + navigator.javaEnabled() + "<br/>"); document.write("<b>Data tainting enabled: </b>" + navigator.taintEnabled()); </script> </body> </html>
Here are some sample outputs produced by above navigator object methods example code in JavaScript. This is the output produced in Google Chrome browser:

Here is the output produced in Mozilla Firefox browser:

Here is the output produced in Safari browser:

Here is the output produced in Microsoft Internet Explorer browser:

« Previous Tutorial Next Tutorial »