Java Script


JavaScript Tutorial


Admission Enquiry Form


Navigator object in Javascript

In JavaScript, object is the container of properties/variables and methods/functions. Navigator is the object which contains some methods to perform some web browser related navigation functions.

Navigator properties and methods

navigator 'online' property in JavaScript

This property checks whether the browser is online or not. If the browser is online it returns true and if the browser is offline then it returns false

var x = "browser is online: " + navigator.onLine;
document.write(x);



Output:

The code above will display :

browser is online: true



navigator 'language' property in JavaScript

The language property returns the language version of the browser.

var lang = "Language of the current browser is : " + navigator.language;
document.write(lang);



Output:

The code above will display :

Language of the current browser is : en-US



navigator 'appName' property in JavaScript

The appName property returns the name of the browser.

var name = "The current browser name is : " + navigator.appName;
document.write(name);



Output:

The code above will display :

The current browser name is : Netscape




navigator 'appVersion' property in JavaScript

The appVersion property returns the version information of the browser.

var version = "Current Browser Version Info: " + navigator.appVersion;
document.write(version);



Output:

The code above will display :

Current Browser Version Info: 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36




navigator 'appCodeName' property in JavaScript

The appCodeName property returns the code name of the current browser.

var codename = "Current Browser CodeName: " + navigator.appCodeName;
document.write(codename);


Output:

The code above will display :

Current Browser CodeName: Mozilla




navigator 'cookieEnabled' property in JavaScript

The cookieEnabled property returns a Boolean value that specifies whether cookies are enabled in the current browser or not.

var cookie = "current browser Cookies Enabled : " + navigator.cookieEnabled;
document.write(cookie);



Output:

The code above will display :

current browser Cookies Enabled : true




navigator 'platform' property in JavaScript

The platform property returns for which platform(Operating System) the current browser is compiled.

var os = "Platform: " + navigator.platform;
document.write(os);



Output:

The code above will display :

Platform: Win32




navigator 'product' property in JavaScript

The product property returns the engine (product) name of the browser.

var name = "Browser's Engine Name is : " + navigator.product;
document.write(name);



browser engine (also known as a layout engine or rendering engine) is a core software components of every major web browser. The primary job of a browser engine is to transform HTML documents and other resources of a web page into an interactive visual representation on a user's device.


Output:

The code above will display :

Browser's Engine Name is : Gecko