Javascript Navigator - 9 Properties (Reference)

Tech:
Javascript
Since:
2 years ago
Views:
3

The javascript navigator object contains information about the user's browser and platform. The navigator object is a global object and it is accessed by the window.navigator property.

cookieEnabled

It returns a Boolean value that indicates whether cookies are enabled or not.

var x = window.navigator.cookieEnabled;
// true

deviceMemory

It returns the amount of device memory in gigabytes.

var x = window.navigator.deviceMemory;
// 8

// No safari

hardwareConcurrency

It returns the number of logical processors available to run threads on the user's computer.

var x = window.navigator.hardwareConcurrency;
// 4

language

It returns a string representing the preferred language of the user, usually the language of the browser UI.

var x = window.navigator.language;
// "en"

languages

It returns an array of DOMString representing the
languages known to the user, by order of preference.

var x = window.navigator.languages;
// ["en-GB", "en-US", "en", "ta", "es"]

maxTouchPoints

It returns the maximum number of simultaneous touch contact points are supported by the current device.

var x = window.navigator.maxTouchPoints;
// 0

userAgent

It returns the user agent string for the current browser.

var x = window.navigator.userAgent;
// "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36"

onLine

It returns a boolean value, with true meaning online and false meaning offline.

var x = window.navigator.onLine;
// true

vendor

It returns the vendor name of the current browser.

var x = window.navigator.vendor;
// "Google Inc."