1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 脚本不得关闭非脚本打开的窗口。Scripts may close only the windows that were opened by it...

脚本不得关闭非脚本打开的窗口。Scripts may close only the windows that were opened by it...

时间:2019-06-26 21:16:23

相关推荐

脚本不得关闭非脚本打开的窗口。Scripts may close only the windows that were opened by it...

今天脚本了里写了一句话:

window.close()

但是浏览器却报了警告提示:Scripts may close only the windows that were opened by it,而且也没有能够关闭我想关闭的页面,怎么办呢?找万能的度娘,搜到的解决方案有:

(1)

window.open('','_self','');

window.close();

(2)

open(location, '_self').close();

这两种我都试过了,还是一样有警告信息,并且无法关闭窗口。

最后一种方案是:

window.location.href="about:blank";window.close();

终于成功关闭窗口啦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。