請問js如何關閉當前頁面,能夠兼容主流的瀏覽器,網(wǎng)上找的這個例子,沒有用//FF中需要修改配置window.close方法才能有作用,為了不需要用戶去手動修改,所以用一個空白頁面顯示并且讓后退按鈕失效//Opera瀏覽器舊版本(小于等于12.16版本)內核是Presto,window.close方法有作用,但頁面不是關閉只是跳轉到空白頁面,后退按鈕有效,也需要特殊處理varuserAgent=navigator.userAgent;if(userAgent.indexOf("Firefox")!=-1||userAgent.indexOf("Presto")!=-1){window.location.replace("about:blank");}else{window.opener=null;window.open("","_self");window.close();}Chrome下提示:Scriptsmaycloseonlythewindowsthatwereopenedbyit.
js如何關閉當前頁面
哆啦的時光機
2019-04-16 17:05:33