netscape.security.PrivilegeManager.enablePrivilege(“UniversalXPConnect”); 时避免出现对话框被称为
嗨,我必须使用 XPCom 在 javascript 中创建、写入、读取本地文件。为此,我在 javascript 的开头添加了以下行。
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
但是当上面的脚本执行时,会出现一个对话框,显示“
**Internet security**
A script from "file://" is requesting enhanced abilities
that are UNSAFE and could be used to compromise your machine or data:
Run or install software on your machine
Allow these abilities only if you trust this source
to be free of viruses or malicious programs.
______ _______
| Deny | | Allow |
-------- ---------
但是我不希望出现该对话框。我该如何避免它?”。谢谢。
Hi i got to create.write,read a local file within the javascript using XPCom. For that i have included the below line at the beginning of javascript.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
But when the above script executes, a dialog box appears saying
**Internet security**
A script from "file://" is requesting enhanced abilities
that are UNSAFE and could be used to compromise your machine or data:
Run or install software on your machine
Allow these abilities only if you trust this source
to be free of viruses or malicious programs.
______ _______
| Deny | | Allow |
-------- ---------
But i dont want the dialog box to be appeared.How can i avoid it?. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不可能的。如果未经用户明确授权,允许网页获得额外的 JavaScript 权限(在本例中为 XPCOM 的完全访问权限),这将是一个主要的安全问题。
I don't think this is possible. It would be a major security problem to allow a web page to gain extra JavaScript privileges (full access to XPCOM in this case) without an explicit authorization by the user.