The Navigator object represents the particular browser and allows script functions to access information about the browser being used to access the document.

PropertiesMethodsEvents
appCodename, appName, appVersion, userAgent, mimeTypes*, plugins* javaEnabled* None
* = supported by Netscape only

The Navigator object provides information about the browser that the user is currently using. All the properties are read-only and can not be dynamically changed. Typically the Navigator object properties are used to determine the users browser and navigate to sections of the site containing browser-specific content.

Navigator Properties
appCodeName
The appCodeName property returns the code name of the current browser. For example :

vCodeName=navigator.appCodeName

would store the current browsers appCodeName property in the variable vCodeName. See below for a table containing the relevant property values for Internet Explorer and Netscape

appName
The appName property returns the name of the current browser. For example :

vName=navigator.appName

would store the current browsers appName property in the variable vName. See below for a table containing the relevant property values for Internet Explorer and Netscape

appVersion
The appVersion property returns the version of the current browser. For example :

vVersion=navigator.appVersion

would store the current browsers appVersion property in the variable vVersion. See below for a table containing the relevant property values for Internet Explorer and Netscape

userAgent
The userAgent property returns a property which is the combination of appCodeName and appVersion properties for the the current browser. For example :

vuAgent=navigator.userAgent

would store the current browsers userAgent property in the variable vuAgent. See below for a table containing the relevant property values for Internet Explorer and Netscape

Internet Explorer and Netscape navigator object values.
NOTE : For this table, Internet Explorer 3.01 and Netscape 3.01b1 for Windows 95/NT were checked. Values for other platforms will differ.

Internet ExplorerNetscape
appCodeNameMozillaMozilla
appNameMicrosoft Internet ExplorerNetscape
appVersion2.0 (compatible; MSIE 3.01;Windows 95)3.01b1 (Win 95;l)
userAgentMozilla/2.0 (compatible; MSIE 3.01;Windows 95)Mozilla/3.01b1 (Win 95;l)

mimeTypes
The Netscape specific mimeTypes property of the navigator object is actually an object in it's own right. It can be considered part of Netscape's LiveConnect technology (which will be merged with Sun's Java Beans technology) to allow interaction with plug-ins (and eventually Java applets). The mimeTypes object contains an array detailing all the mimeTypes that the users browser can handle, either natively, by helper applications, or by plug-in modules. As an object, it has it's own properties, which are :

type
Details the particular MIME type that is handled by the particular plug-in. For example, the LiveAudio plug-in (as standard with Netscape), handles (amongst others), the MIME-type : audio/x-wav
description
A description of the particular MIME type. For example, the description of the above LiveAudio handled MIME type is : WAV
enabledPlugin
This gives a reference to whether the particular MIME type is to be handled by a Plug-in. It details whether the particular plug-in is enabled or not.
suffixes
This gives the suffixes (file extensions) of the file types of the particular MIME types. For example, the suffix for the above MIME type is wav
length
This returns the total number of MIME types that Netscape can handle, internally, or via installed plug-ins.

As an example, the following code section checks to see whether the user has a suitable VRML plug-in available and if so, displays a VRML world, giving a notice if the plug-in isn't available :

var vVRMLallowed = navigator.mimeTypes["x-world/x-vrml"]
if (vVRMLallowed)
document.writeln("Click <A HREF='htmlib.wrl'>here</A> to see a " + vVRMLallowed.description)
else
document.writeln("Too bad, can't show you any virtual worlds.")

NOTE : See how it's possible to reference MIME types in the mimeTypes object by it's actual type property. The type and description properties can be used in this way.

plugins
Like the above mimeTypes object, the plugins object is also Netscape specific. It is an array of all the currently installed plug-ins available to the navigator object. As above, the plugins object contains it's own properties, which can be used to determine suitable content to present to the user. The properties of the plugins object are :

name
This property details the actual name of the plug-in. For example, on a standard Netscape installation, the plug-in installed to handle files of the audio/wav MIME type is named LiveAudio
filename
This returns the exact file name of the particular referenced plug-in module.
description
Contains a description of the plug-in module referenced. For example, the description of the LiveAudio plug-in is "LiveAudio - Netscape Navigator sound playing component".
length
This returns the total length of the plug-ins array. I.e. the number of plug-ins the user has installed and available for use.

As an example, the following code section checks to see whether the user has the Live3D plug-in available and if so, displays a VRML world, giving a notice if the plug-in isn't available :

var vVRMLallowed = navigator.plugins["Live3D Plugin DLL"]
if (vVRMLallowed)
document.writeln("Click <A HREF='htmlib.wrl'>here</A> to see a Virtual world"
else
document.writeln("Too bad, can't show you any virtual worlds.")

NOTE : As in the above example, it is possible to reference plugins by their name property.

Navigator Methods
javaEnabled
The Netscape specific javaEnabled method can be used to determine whether the user has Java capabilities enabled in their browser. (Users can allow/disallow Java capabilities via a setting in the Options|Network Preferences|Languages dialog of Netscae. For example :

if (navigator.javaEnabled()) {
doSomeJavathing()
}
else doSomethingElse()

Navigator Events
The Navigator object has no events.


The History Object Scripting Object Model Overview The Location Object