2017-05-22 44 views
0

我在我的網頁,退出按鈕當過我該按鈕點擊,目前的瀏覽器選項卡應closed.I寫了下面這段代碼在IE工作僅適用於瀏覽器,但需要在Chrome和Firefox中運行。 請幫幫我。關閉當前標籤頁使用JavaScript的多種瀏覽器(Chrome,IE,火狐)

代碼: window.top.close();

+0

是一個'iframe'運行你的網頁? –

+0

是的,iframe正在使用。 –

+0

可能重複的[是否有可能從子窗口(JavaScript)關閉父窗口?](http://stackoverflow.com/questions/8121755/is-it-possible-to-close-parent-window-from-child- javascript) –

回答

0

你不能這樣做,在其他瀏覽器。如果您檢查控制檯,您將看到:

Scripts may close only the windows that were opened by it 
相關問題