关闭当前窗体报以下js错误: Scripts may close only the windows that were opened by it (脚本只能关闭由它打开的窗口) 使用场景,在js中关闭页面的js,如下: window.opener = null; window.open('', '_self'); window.close(); 未能通过. 关闭页面的代码写在一个ajax返回的结果中的,如下: $.ajax({ type: 'post', url: "url", suc…
非window.open形式打开的子页面用js的window.close在chrome下就会提示scripts may close only the windows that were opened by it. 网上的很多解决方法都是把当前页面为空,在IE和360浏览器也不能直接关闭页面,翻到stack overflow的解决方案: if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.index…
今天脚本了里写了一句话: window.close() 但是浏览器却报了警告提示:Scripts may close only the windows that were opened by it,而且也没有能够关闭我想关闭的页面,怎么办呢?找万能的度娘,搜到的解决方案有: (1) window.open('','_self',''); window.close(); (2) open(location, '_self').close(); 这两种我都试过了,还是一样有警告信息,并且无法关闭窗口…