如何关闭使用JavaScript的Firefox浏览器窗口?
function CloseWindow()
{
window.close();
}
上述代码适用于IE,但Firefox不允许关闭浏览器窗口 任何解决方案???如何关闭使用JavaScript的Firefox浏览器窗口?
类似的帖子答案
function closeWindow() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
alert("This will close the window");
window.open('','_self');
window.close();
}
closeWindow();
原因 为了安全起见,你的脚本不能关闭窗口/标签,它没有开。
解决方法是在导航历史记录的较早时间点显示年龄提示。然后,您可以选择允许他们根据他们的输入来输入您的网站。
除了关闭显示提示的页面,您可以简单地说,“对不起”,或者可能将用户重定向到他们的主页。
你怎么知道这与提示有关?我错过了什么吗? – Fishcake
尝试使用自对象
<a href="javascript:self.close()">Close Window</a>
步骤1:在地址栏类型的“关于:配置”,然后按回车键
第二步:“我会小心,我保证”,点击此按钮
第3步:“dom.allow_scripts_to_close_windows; true”搜索此行并双击它。
不知道你如何容纳你的用户谁将不得不遵循相同的说明。 – Brian
http://csharpdotnetfreak.blogspot.com/2008/11/javascript-windowclose-does-not-work-in.html –
[我如何在Mozilla Firefox 3上使用Javascript关闭窗口?]( http://stackoverflow.com/questions/760422/how-can-i-close-a-window-with-javascript-on-mozilla-firefox-3) –