地址栏输入

about:config

搜索

dom.allow_scripts_to_close_windows

改为true即可。

附兼容所有浏览器的关闭页面脚本:

<script>
var browserName = navigator.appName;
if (browserName == "Netscape") {
    function closeme() {
        window.open('', '_parent', '');
        window.close();
    }
} else {
    if (browserName == "Microsoft Internet Explorer") {
        function closynoshowsme() {
            window.opener = "whocares";
            window.close();
        }
    }
}
</script>

原文来自:http://www.cnblogs.com/blodfox777/archive/2008/09/24/1297881.html

Related Posts: Firefox-允许JavaScript关闭当前窗口的操作办法 :