可能重複:
window.close() doesn’t work on Firefox, any work around?如何關閉瀏覽器窗口
我需要使用jQuery當點擊該按鈕,關閉當前瀏覽器窗口。我嘗試了很多方法,但它們不適用於所有瀏覽器:我的代碼是:
$('#btnCloseBrowser').click(function() {
// close();
// this.close();
// window.parent.close();
// window.close();
// self.cose();
window.setTimeout("window.close()", 1000);
});
});
// close(); // this.close(); // window.parent.close(); // window.close(); // self.cose();
這適用於IE瀏覽器,但對於Firefox無法正常工作,鉻
你有沒有做[研究](http://stackoverflow.com/a/2512687)? –
這已經被問到:http://stackoverflow.com/questions/760422/how-can-i-close-a-window-with-javascript-on-mozilla-firefox-3 –