The solution is as follows:
Enter about:config in the Firefox address bar
Find dom.allow_scripts_to_close_windows in the configuration list
Right-click and select to change the above false to true.
Note: The default is false to prevent the script from closing the window randomly
Of course, if the window is opened through window.open, it can be closed.
The best closing method compatible with multiple browsers, this site has been updated before
http://www.jb51.net/article/16788.htm