我想关闭窗口。我的脚本在ie和firefox 2.x中工作正常,但在firefox 3.x及更高版本中无法正常工作。我正在使用以下脚本。关闭firefox中的窗口
function closeWindow() {
window.open('', '_self', ''); //bug fix
window.close();
}
请找到一些解决方案。 谢谢大家。
我想关闭窗口。我的脚本在ie和firefox 2.x中工作正常,但在firefox 3.x及更高版本中无法正常工作。我正在使用以下脚本。关闭firefox中的窗口
function closeWindow() {
window.open('', '_self', ''); //bug fix
window.close();
}
请找到一些解决方案。 谢谢大家。
window.open()返回一个对打开窗口的引用,你可以用它作为close()。例如:
var win = window.open(url)
win.close()
Firefox(正确)不会让您关闭您未打开的窗口。
function closeWindow() {
if (navigator.appName != "Microsoft Internet Explorer") {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
}
alert("This will close the window");
window.open('', '_self');
window.close();
}
这是工作在两个Firefox和IE
不再适用于Firefox 8,但它确实修复了使用IE 8时的警告消息 – Alok 2011-12-09 18:03:08
请参阅讨论[这里](http://stackoverflow.com/questions/760422/how-can-i-close-a-window-与-JavaScript的上Mozilla的Firefox的-3)。简短回答:您无法关闭未在Firefox中修复的JavaScript窗口。 – emfurry 2011-05-27 05:12:29