Requesting privileges (Security related)

Your script needs to request privileges when it requires them.

So long as you can sign scripts for Netscape Navigator, you can then make requests for privileges when those scripts run. This is done by means of the privilege manager.

Because the Netscape Navigator security model is based on the Java security model, the Netscape Navigator browser requests its privileges through the Java mechanisms. These are encapsulated in a class that you can access from inside JavaScript.

The downside of this is that there is no meaningful value returned when the request is made. If the request for a privilege is denied, the error causes a Java exception which is difficult to trap from JavaScript. It is possible that new browser versions will support an exception handling mechanism.

There are two principle methods that are useful here, one to request the privilege and the other to relinquish it.

enablePrivilege() - Requests the privilege passed as a string argument

disablePrivilege() - Relinquishes the privilege based on a string argument

Example code:

   // Request the file reading privilege"UniversalFileRead")

See, PrivilegeManager object, PrivilegeManager.disablePrivilege(), PrivilegeManager.enablePrivilege(), Signed scripts, UniversalBrowserAccess, UniversalBrowserRead, UniversalBrowserWrite, UniversalFileRead, UniversalPreferencesRead, UniversalPreferencesWrite, UniversalSendMail