1

每次我尝试使用window.close();我都会得到错误Scripts may only close the windows that were opened by them,有没有办法绕过这个?

4

1 回答 1

1

好像不是。

请参阅文档

此方法只能在使用该Window.open()方法的脚本打开的窗口上调用。如果窗口不是由脚本打开的,控制台中会出现类似的错误:Scripts may not close windows that not open by script。

另请参阅window.close 和 self.close 不要关闭 Chrome 中的窗口

于 2021-12-17T12:25:53.397 回答