Hi There!
I am new to javascript and I cant make a code work.
I am trying to automatically load a security module in firefox and found this code on the internet:
[code=html]
<head><title>This is an example page</title></head>
<body>
<script type=”text/javascript”>
<!–
const nsIPKCS11 = Components.interfaces.nsIPKCS11;
const nsPKCS11ContractID = “@mozilla.org/security/pkcs11;1”;
const p11path = [some path]
try{
var PKCS11 = Components.classes[nsPKCS11ContractID].getService(nsIPKCS11);
PKCS11.addModule(“ACS PKCS#11 Module”, p11path, 0, 0);
}catch(e){
alert(e);
}
//–>
</script>
</body>
From the code above, I am getting an error:
[QUOTE]
“Error: Permission denied to access property ‘classes'”
So I searched the net again for this error and found that I have to enable privilege before I call the classes property. But when I added this line before the calling of the classes property:
[QUOTE]
netscape.security.PrivilegeManager.enablePrivilege(‘UniversalXPConnect’);
I got a new error stating:
[QUOTE]
“TypeError netscape.security.PrivilegeManager is undefined”
Please help!
Thanks!