- 传统的JS敞开以后窗口
window.opener=null;window.open('',self);window.close();
- vue敞开以后窗口
window.opener = nullwindow.open("about:blank", "_top").close()
- 其余
var userAgent = navigator.userAgent;if (userAgent.indexOf("MSIE") > 0) { if (userAgent.indexOf("MSIE 6.0") > 0) { window.opener = null; window.close(); } else { window.open("", "_top"); window.top.close(); }} else if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") != -1) { window.location.href = "about:blank "; //火狐默认状态非window.open的页面window.close是有效的 //window.history.go(-2);} else { window.opener = null; window.open("about:blank", "_self"); window.close();}
4.阐明
_blank - URL加载到一个新的窗口(默认)_parent - URL加载到父框架_self - URL替换以后页面_top - URL替换任何可加载的框架集