如何使用检查元素关闭 window 而不必打开它?
How to I use inspect element to close the window without it having to open it too?
每次我尝试使用 window.close();
时,我都会得到错误 Scripts may only close the windows that were opened by them
,有什么办法可以绕过这个吗?
好像不是。
查看 documentation:
This method can only be called on windows that were opened by a script using the Window.open()
method. If the window was not opened by a script, an error similar to this one appears in the console: Scripts may not close windows that were not opened by script.
另见 window.close and self.close do not close the window in Chrome。
每次我尝试使用 window.close();
时,我都会得到错误 Scripts may only close the windows that were opened by them
,有什么办法可以绕过这个吗?
好像不是。
查看 documentation:
This method can only be called on windows that were opened by a script using the
Window.open()
method. If the window was not opened by a script, an error similar to this one appears in the console: Scripts may not close windows that were not opened by script.
另见 window.close and self.close do not close the window in Chrome。