Each time I try to use window.close();
I just get the error Scripts may only close the windows that were opened by them
, is there any way to bypass this?
CodePudding user response:
Looks like it’s not.
See the 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.
See also window.close and self.close do not close the window in Chrome.