Home > JavaScript > Navigator Object in JavaScript

Navigator Object in JavaScript

We need to know how to use properties and methods of Navigator object in JavaScript to make powerful applications. Navigator object gives us to get browser information of client. There is a list of all properties and methods in Javascript.

I. All Common Navigator Properties in JavaScript

Property

Description

appCodeName :

The code name of the browser
(ie: Mozilla)

appName :

The name of the browser
(ie: Netscape)

appVersion :

The version information of the browser
(ie: 5.0 (Windows; en))

mimeTypes :

Returns array of all MIME types supported by the client

platform :

Returns the platform of visitor’s computer
(ie: Win32)

plugins :

Returns array of all plug-ins which is installed on visitor’s computer

userAgent :

Returns the user-agent header
(ie: Mozilla/5.0 (Windows; U; Windows NT 6.0; tr; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729))

onLine :

Returns bolean value of browser’s online status
(ie: true)

cookieEnabled :

Returns bolean value of browser’s cookie status
(ie: false)

cookieEnabled :

Returns bolean value of browser’s cookie status
(ie: false)


II. Special Navigator Properties in JavaScript

This is a list of special navigator properties of Browsers.

Property

Description

Works On

appMinorVersion :

Returns the minor version of the browser.
(ie: 0)

MSIE 4.0
Opera

cpuClass :

returns the CPU class of the browser’s system.
(ie: x86)

MSIE 4.0

opsProfile :

Returns null value in MSIE and Netscape Navigator.

MSIE 5.0 only

userProfile :

Returns user profile

MSIE 4.0

systemLanguage :

Returns the system language of visitor’s computer. It may return language valua as code on some platforms.
(ie: en)

MSIE 4.0

userLanguage :

Returns the user language of client
(ie: fr)

MSIE 4.0
Opera

language :

Returns the language of client
(ie: en)

FireFox
Opera

browserLanguage :

Returns the language of client’s browser.
(ie: en)

Opera Only

oscpu :

Returns a string that identifies the current operating system.
(ie: Windows NT 6.0)

Firefox Only

vendor :

Returns the name of the browser vendor for the current browser.
(ie: Netscape6)

Firefox Only

vendorSub :

is the substring of the vendor having to do with the vendor version number.
(ie: 6.1)

Firefox Only

product :

returns the product name of the browser.
(ie: Gecko)

Firefox Only

productSub :

returns the build number of the browser.
(ie: 20090824)

Firefox Only

buildID :

Returns the build identifier of the browser.
(ie: 20090824101234)

Firefox Only

III. All Navigator Methods in JavaScript

Method

Description

javaEnabled()

MSIE 4.0, Opera, FireFox   

Returns bolean value of browser’s JavaScript-Enabled status
(ie: true)   

refresh()

MSIE 4.0, Opera, FireFox   

Checks for any new plug-ins installed on the browser
(ie: navigator.plugins.refresh())   

preference()

MSIE 4.0, Opera, FireFox   

Reads or sets any user preferences in the browser. Changing a preference via this method requires the UniversalPreferencesWrite privilege.
(usage: navigator.preference(name) or
navigator.preference(name, value))
(ie: navigator.preference(security.enable_java, false);)   

savePreferences()

   

Saves immediately the Navigator preferences to the local file prefs.js.
Navigator also saves preferences automatically when it exits. Requires the UniversalPreferencesWrite privilege.   

taintEnabled()

MSIE 4.0   

Returns whether data tainting is enabled.
(ie: false)   

registerContentHandler()

Firefox   

Gives autorithy to web sites to register themselves as possible handlers for content of a particular MIME type.
(ie: navigator.registerContentHandler(”application/vnd.mozilla.maybe.feed”, “http://www.memiso.com/?foo=%s”, “Memiso Feeds”);)   

registerProtocolHandler()

MSIE 4.0   

Gives autorithy to web sites to register themselves as possible handlers for content of a particular protocols.
(ie: navigator.registerProtocolHandler(”mailto”, “https://www.memiso.com/?uri=%s”, “Send Mail”);)   

mozIsLocallyAvailable()

MSIE 4.0   

Checks whether or not a specified resource is available.
(ie: var isThere = navigator.mozIsLocallyAvailable(”memiso_file.rar”, true);
if (isThere) {alert(”Yes, There is”);}
)   

Bookmark and Share
  1. No comments yet.
  1. No trackbacks yet.
eXTReMe Tracker