-8

这是我的代码:

   function closewindow() {
        alert("This will close the window");
        netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
        window.open('http://localhost/Authenticate/WebForm1.aspx','_self','');           
        window.close();
        return false;
    }

在 IE 中运行良好,但在 Firefox 和 chrome 中运行良好。

在 Firefox 中,当 dom.allow_scripts_to_close_window 在 about:config 中手动设置为 true 时,它​​可以正常工作。

告诉如何在 javascript 中设置 dom.allow_scripts_to_close_window 或者是他们的任何其他方式来做到这一点。

4

1 回答 1

0

proper browser security only allows script to close windows opened by that script. IE has a security hole that can be used to circumvent this (open self), but other browsers don't. hopefully IE will patch this hole.

you can not, not even with IE (well you can if your site is trusted and security is turned low enough) change security setting via script.

于 2013-04-30T06:31:07.540 回答