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 3.0 and above 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.

Note : The examples below are targetted at the Window range of platforms (3.1(1), Windows 95 and Windows NT) - this reference does not support possible cross-platform differences for browsers.

Back to the Top

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. The navigator.appCodeName value for both Netscape and Internet Explorer is 'Mozilla'.

Back to the Top

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. The navigator.appName values for Netscape and Internet Explorer are 'Netscape' and 'Microsoft Internet Explorer' respectively.

Back to the Top

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.
The Netscape navigator.appVersion string contains information of the following format :

<version> (<Operating_System>; I)

where <Operating_System> is 'Win16', 'Win95', or 'WinNT'. For example, for Netscape 3.0 on the Windows 95 platform, the navigator.appVersion string would be :

3.0 (Win95; I)

The Internet Explorer navigator.appVersion string contains information of the following format :

<compatible_Netscape_version> (compatible; <version>; <Operating_System>)

Where <compatible_Netscape_version> is 2.0 for Internet Explorer 3.01 (and 3.02) and <Operating_System> is either 'Windows 3.1(1)', 'Windows 95' or 'Windows NT'. For example, for Internet Explorer 3.02 on the Windows 95 platform, the navigator.appVersion string would be :

2.0 (compatible; MSIE 3.02; Windows 95)

Back to the Top

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.
Both Netscapes and Internet Explorers navigator.userAgent string is of the format :

appCodeName/appVersion

So, using the above examples, Netscape 3.0 on the Windows 95 platform returns :

Mozilla/3.0 (Win95; I)

while Internet Explorer 3.02 on the Windows 95 platform returns :

Mozilla/2.0 (compatible; MSIE 3.02; Windows95)

for the navigator.userAgent value.

Back to the Top

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.

Back to the Top

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.

Back to the Top

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()

Back to the Top

Navigator Events
The Navigator object has no events.


The History Object Scripting Object Model Overview The Location Object