scripts may close only the windows that were opened by it 浏览器JS控制无法关闭当前页面
2021-04-30 12:28
标签:ack logs script opened about flow location highlight sel 不是window.open形式打开的子页面用js的window.close在chrome下就会提示关不了。 网上的很多解决方法都是把当前页面为空,在IE和360浏览器也不能直接关闭页面,翻到stack overflow的解决方案: open(location, ‘_self‘).close(); 加了这个非火狐和chrome就能直接把当前页面关闭了。 scripts may close only the windows that were opened by it 浏览器JS控制无法关闭当前页面 标签:ack logs script opened about flow location highlight sel 原文地址:http://www.cnblogs.com/KuJo/p/7804341.html if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
open(location, ‘_self‘).close();
window.location.href="http://www.soscw.com/about:blank";
window.close();
}else {
window.opener = null;
window.open("", "_self");
window.close();
open(location, ‘_self‘).close();
}
文章标题:scripts may close only the windows that were opened by it 浏览器JS控制无法关闭当前页面
文章链接:http://soscw.com/index.php/essay/80400.html