DiamondUp
DiamondUp

Reputation: 21

How to I use inspect element to close the window without it having to open it too?

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?

Upvotes: 1

Views: 822

Answers (1)

Alt Zh
Alt Zh

Reputation: 59

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.

Upvotes: 1

Related Questions