0% found this document useful (0 votes)
36 views3 pages

JavaScript Navigator Object Overview

The JavaScript Navigator object provides information about the user's web browser and operating system, accessible via window.navigator. It includes properties such as appName, appVersion, and online status, which can be used to detect browser details and connectivity. Additionally, examples are provided for checking the operating system and browser information using HTML and JavaScript functions.

Uploaded by

shubrattporwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

JavaScript Navigator Object Overview

The JavaScript Navigator object provides information about the user's web browser and operating system, accessible via window.navigator. It includes properties such as appName, appVersion, and online status, which can be used to detect browser details and connectivity. Additionally, examples are provided for checking the operating system and browser information using HTML and JavaScript functions.

Uploaded by

shubrattporwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Window Navigator Javascript

Javascript Navigator Object


The Javascript Navigator is an object of the window interface, it provides
information about the web browser and the operating system. It can be
used to detect the browser and operating system of the user.

The Navigator object is accessed using [Link] or


simply navigator.

It is a read-only property. The types of information that can be retrieved


using navigator objects are:

 Weather user is online


 The operating user is using (platform)
 Browser user is using
 Browser Version
 Weather Cookies are enabled or not
 Browser Language
 And many more...

JavaScript Navigator Properties


Here is the list of Javascript Navigator properties:

Property Description

[Link] Returns the code name of the browser.


me

[Link] Returns the name of the browser.

[Link] Returns the version information of the browser.

[Link] Returns true if cookies are enabled, otherwise false.


ed

[Link] Returns a Geolocation object that can be used to


locate the user's position.

[Link] Returns the language of the browser.

[Link] Returns true if the browser is online, otherwise false.

[Link] Returns for which platform the browser is compiled.

[Link] Returns the engine name of the browser.

[Link] Returns the user-agent header sent by the browser to


the server.

Detect online offline


We can check the internet connection status of the browser and can tell
whether the browser is online or offline.

To check the online status of browsers use [Link], it returns


a boolean value. It will return true if the user is online and false if the use

Note: [Link] is not trustable, in some cases it always returns


true.r is offline.

Detect Operating System in Javascript


To get the operating system of a user you can use the platform as well
as appVersion. Both properties result in the operating system of the user in
different formats.

Don't rely on these properties to always return the correct result.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript - Navigator operating system</title>
</head>
<body>
<h2>Using Navigator's "platform" and "appVersion" property to check operating system.</h2>
<p id="output"></p>
<button onclick="check()">Check Operating System</button>

<script>
function check() {
var os_by_appVersion = [Link];
var os_by_platform = [Link];
[Link]("output").innerHTML = "OS by appVersion property :" +
os_by_appVersion + "<br> OS by platform property : " + os_by_platform;
}

</script>
</body>
</html>

Get Browser Name and Version using


Javascript
Using the navigator object we can access many information related to the
browser.
 appName - Returns the name of the browser
 appCodeName - The returns code name of the browser
 userAgent - Returns user agent string for the current browser. It
includes all information regarding the browser and operating system

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript - Navigator browser information</title>
</head>
<body>
<h2>Using Navigator's properties to get browser information.</h2>
<p id="output"></p>
<button onclick="check()">Check Browser Info</button>

<script>
function check() {
var appname = [Link];
var appcodename = [Link];
var user_agent = [Link];
[Link]("output").innerHTML = "App name : " + appname + "<br> App code
Name : " + appcodename + "<br> User Agent information : "+ user_agent;
}
</script>
</body>
</html>

You might also like