标签:ack logs script opened about flow location highlight sel
不是window.open形式打开的子页面用js的window.close在chrome下就会提示关不了。
网上的很多解决方法都是把当前页面为空,在IE和360浏览器也不能直接关闭页面,翻到stack overflow的解决方案:
if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) { open(location, ‘_self‘).close(); window.location.href="about:blank"; window.close(); }else { window.opener = null; window.open("", "_self"); window.close(); open(location, ‘_self‘).close(); }
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