You can use the preference method to set Netscape Navigator preferences , such as whether the browser should warn the user before accepting cookies and what screen colors to use. Netscape lists about 16 pages of preferences and their possible settings currently at http://developer.netscape.com/docs/manuals/communicator/preferences/. Here are a few to give you a sampling:
For more details and settings, take a look at http://developer.netscape.com/docs/manuals/communicator/preferences/. Here's an example that toggles whether the browser will warn the user before accepting cookies. Note that to set preferences, this script enables and disables the UniversalPreferencesRead and UniversalPreferencesWrite security privileges. The browser will check with the userusing a dialog boxbefore changing this privilege level. Note that this example uses getElementById , which is not supported in NS4; if you want to use that browser, you might change this code to write results to a text field rather than a <DIV> element: (Listing 10-02.html on the web site)<HTML> <HEAD> <TITLE>Setting Netscape Navigator Preferences</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function getPref() { netscape.security.PrivilegeManager.enablePrivilege( "UniversalPreferencesRead") if(navigator.preference('network.cookie.warnAboutCookies')){ document.getElementById("div1").innerHTML = "Will warn before accepting cookies." } else { document.getElementById("div1").innerHTML = "Will not warn before accepting cookies." } netscape.security.PrivilegeManager.revertPrivilege( "UniversalPreferencesRead") } function warnCookie() { netscape.security.PrivilegeManager.enablePrivilege( "UniversalPreferencesWrite") navigator.preference('network.cookie.warnAboutCookies', true) netscape.security.PrivilegeManager.revertPrivilege( "UniversalPreferencesWrite") getPref() } function noWarnCookie() { netscape.security.PrivilegeManager.enablePrivilege( "UniversalPreferencesWrite") navigator.preference('network.cookie.warnAboutCookies', false) netscape.security.PrivilegeManager.revertPrivilege( "UniversalPreferencesWrite") getPref() } // --> </SCRIPT> </HEAD> <BODY ONLOAD="getPref()"> <H1>Setting Netscape Navigator Preferences</H1> <FORM> <INPUT TYPE="BUTTON" NAME="warn" ONCLICK="warnCookie()" VALUE="Warn before accepting cookies"> <BR> <INPUT TYPE="BUTTON" NAME="nowarn" ONCLICK="noWarnCookie()" VALUE="Do not warn when accepting cookies"> </FORM> <BR> <DIV ID="div1"></DIV> </BODY> </HTML> You can see the results in the Netscape Navigator in Figure 10.2, where I've changed the default behavior of the browser to warn the user before accepting cookies. Figure 10.2. Setting Netscape Navigator preferences.
|