gpt4 book ai didi

javascript - Chrome “Scripts may close only the windows that were opened by it” 错误

转载 作者:行者123 更新时间:2023-11-29 19:15:05 27 4
gpt4 key购买 nike

window.close();//false

window.open(location, '_self', '');
window.close();//false

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

Chrome 45.0.2454.85 m,Firefox 也有问题。

请帮忙...

Console option screenshot

最佳答案

您应该将打开的窗口存储在一个变量中。

var popup = window.open(location, '_blank', '');
popup.close();

编辑:在 _self 中打开不起作用,因为您在同一屏幕中打开一个新页面,您可能想像我编辑的那样做 _blank。

关于javascript - Chrome “Scripts may close only the windows that were opened by it” 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35936011/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com