我們經(jīng)常在頁面中用window.close()來關(guān)閉當(dāng)前頁面,但是有時候會遇到關(guān)閉不了的情況,原因很簡單window.open為空。
所以很多時候我們只要這樣寫就可以了。
window.open('','_parent','');
window.close();
但這一招現(xiàn)在已經(jīng)不管用了,在firefox2.0.6和safari 3.0.0上面都無法關(guān)閉當(dāng)前頁面,
在相關(guān)文檔中是這樣描述的:
Navigator 2.0: closes any window.
Navigator 3.0: closes only windows opened by JavaScript.
Navigator 4.0: must use signed scripts to unconditionally close a window
也就是說我們無法關(guān)閉非腳本打開的窗口,如果在firefox2.0.6上調(diào)用Window.close()關(guān)閉非腳本打開的窗口,在錯誤控制臺中會看到相關(guān)信息。
posted on 2007-08-24 14:05
交口稱贊 閱讀(5090)
評論(6) 編輯 收藏 所屬分類:
J2EE & WEB