|Object properties:||appCodeName, appMinorVersion, appName, appVersion, browserLanguage, constructor, cookieEnabled, cpuClass, language, onLine, opsProfile, platform, securityPolicy, systemLanguage, userAgent, userLanguage, userProfile|
|Object methods:||javaEnabled(), plugins, preference(), savePreferences(), taintEnabled()|
The navigator object is named after Netscape Navigator but is also present in other browsers since it has become the de facto standard way of enquiring as to a browser's provenance.
You can inspect the various properties belonging to the navigator object and establish the name and type of the browser, its version and the platform it is running on.
The navigator object is available as a property of the window and also the Global object but it will be the same navigator object. There is only one and you cannot instantiate another.
As this object is persistent, you might add properties to it that can be passed from window to window. However this will only work on Netscape, because MSIE seems to initialize a new navigator object for each window. MSIE does allow you to add properties to navigator object but they are private to that window. Netscape shares them across windows. The example shows how to make this work.
You can accomplish the same thing in a cross browser portable manner by using a frameset and storing properties in the top level frameset's Global object. You can also (if security allows) write scripts to communicate between windows, in which case you may need to make sure the scripts are aware of multiple document objects as well as windows. This can get tricky and you may need to make sure the scripts run in the correct windows and return a value to a caller. This should ensure they run in the correct scope.
Netscape 6.0 provides a sidebar which you should expect to be persistent. There's a similar sidebar in MSIE too. Netscape clearly intends you to script its sidebar but right now the implementation is a bit buggy. It might be too much to hope for, but digging into the internals of these suggests that RDF is involved, which may point to some commonality. Maybe we will be able to use the sidebar in the browsers as a repository for session storage, or persistent values that we can access from script, but it's not there and working yet.
You cannot enumerate the properties of the navigator (clientInformation) object in MSIE version 4.5 for Macintosh. This may apply to other platform implementations of MSIE version 4.5 as well.
The navigator object is much better supported in version 5.0 of MSIE for Macintosh, which was released in the Spring of 2000.
The example below was found not to work on Netscape 6, due to bugs.
<!-- Save this in navigator.html --> <HTML> <HEAD></HEAD> <BODY> <SCRIPT> navigator.myNewProperty = "session global value"; open("navigator1.html") </SCRIPT> </BODY> </HTML> --------------------------------------------------------------- <!-- Save this in navigator1.html --> <HTML> <HEAD></HEAD> <BODY> <SCRIPT> document.write(navigator.myNewProperty); </SCRIPT> </BODY> </HTML>