Availability: |
| |||
JavaScript syntax: | N | myPrivilegeManager = 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.
enablePrivilege() - Requests the privilege passed as a string argument
disablePrivilege() - Relinquishes the privilege based on a string argument
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.
Method | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
disablePrivilege() | 1.2 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
enablePrivilege() | 1.2 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
Prev | Home | Next |
private | Up | PrivilegeManager.disablePrivilege() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |