PrivilegeManager object (Java class)

A Java class that administers privileges.

Availability:

JavaScript - 1.2
Netscape - 4.0
JavaScript syntax:NmyPrivilegeManager = netscape.security.PrivilegeManager
Object methods:disablePrivilege(), enablePrivilege()

Because the Netscape 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 that is difficult to trap from JavaScript. It is possible that more recent 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.

It is good practice to disable the privilege as soon as you no longer need it. In any case the privilege is given up when the function that requested it exits.

Trying to examine an instance of this class leads to some interesting run-time errors. That is perhaps understandable since the object is involved with keeping things secret. Even after requesting privileges, you cannot examine the internals of an instance of this class.

See also:netscape.security.PrivilegeManager, Requesting privileges, UniversalBrowserAccess, UniversalBrowserRead, UniversalBrowserWrite, UniversalFileRead, UniversalPreferencesRead, UniversalPreferencesWrite, UniversalSendMail

MethodJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
disablePrivilege()1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-
enablePrivilege()1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-