Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing

Example 10.1:
Objects and Properties--the navigator Properties

[This example works with Netscape Navigator 3. In Netscape Navigator 2 and Internet Explorer 2 you'll see an error message, and the last two properties will not be displayed.]

This example displays the properties of the Navigator object.


These are the scripts we used. First, in the HEAD: <SCRIPT LANGUAGE="JavaScript"> <!-- function DisplayProperties() { document.write("<P><B>navigator.appCodeName =</B> " + navigator.appCodeName) document.write("<P><B>navigator.appName =</B> " + navigator.appName) document.write("<P><B>navigator.appVersion =</B> " + navigator.appVersion) document.write("<P><B>navigator.userAgent =</B> " + navigator.userAgent) document.write("<P>The following are JavaScript 1.1 properties, which won't appear in Navigator 2.") document.write("<P><B>navigator.mimeTypes[0].type =</B> " + navigator.mimeTypes[0].type) document.write("<P><B>navigator.plugins[0].name =</B> " + navigator.plugins[0].name) document.write("<P>The following are JavaScript 1.2 properties, which won't appear in Navigator 2 or 3.") document.write("<P><B>navigator.language =</B> " + navigator.language) document.write("<P><B>navigator.platform =</B> " + navigator.platform) } //--> </SCRIPT> Later in the script the function is called from this script: <SCRIPT LANGUAGE="JavaScript"> <!-- DisplayProperties() //--> </SCRIPT>


Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing