Skip to content

Navigator object in JavaScript | API

  • by

JavaScript navigator object is a property of the window object and it has information about the browser. You can use it for browser detection or get browser information such as appName, appCodeName, userAgent, etc.

The navigator object can be accessed by:


Navigator Object Properties

Here are the properties of the navigator object that returns information from the browser.

appCodeNameReturns browser code name
appNameReturns browser name
appVersionReturns browser version
cookieEnabledReturns true if browser cookies are enabled
geolocationReturns a geolocation object for the user’s location
languageReturns browser language
onLineReturns true if the browser is online
platformReturns browser platform
productReturns browser engine name
userAgentReturns browser user-agent header

Navigator Object Methods

Here are the methods of navigator objects.

javaEnabled()Returns true if the browser has Java enabled
taintEnabled()Removed in JavaScript version 1.2 (1999).

Navigator object in JavaScript

Simple example code.

<!DOCTYPE html>
      console.log("appCodeName: ", navigator.appCodeName);  
      console.log("appName: ", navigator.appName);  
      console.log("appVersion: ", navigator.appVersion);  
      console.log("cookieEnabled: ", navigator.cookieEnabled);  
      console.log("language: ", navigator.language);  
      console.log("userAgent: ", navigator.userAgent);  
      console.log("platform: ", navigator.platform);  
      console.log("onLine: ", navigator.onLine);  




Do comment if you have any doubts or suggestions on this JS object topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

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