Window.close () doesn't work in Firefox, any work around?

I am trying to close a window using window.close (), but this only works in IE, but not in Firefox. Has anyone come across this and any job?

Thanks...

+3
source share
4 answers

Did your script open a window? Firefox 2 and later do not allow scripts to close windows that they did not open.

You can try this trick , but I have no idea if it will work. I live on the side of the population, who believes that users should control their browser windows, not the application (despite the fact that you have a good reason for this).

+6
source

, . , .

+3

This is a security feature added to FF. You can see that this was intentionally prohibited for Mozilla site documents.

This method is only allowed for windows opened with a script using the window.open method.

+2
source

window.close();worked for me (FF 31.5.0). However, in order for me to start it, I had to change additional settings:

about: config → dom.allow_scripts_to_close_windows = true;

+2
source

Source: https://habr.com/ru/post/1723194/