Solve the problem that Firefox sometimes uses window.close() script to close the current window.

  

When we want to make a close window button, we will use a JavaScript function that is window.close(), but I found that there is no problem under IE. After clicking the close button, the close window will be executed, but it will sometimes be invalid in Firefox browsing. In Firefox, as long as the window is not opened by the script, then the window.close() function is invalid. After finding the answer on the Internet, it is found that so far, there is no code that can be solved by Firefox. Sometimes the window.close() script cannot be closed. The current window method, but you can solve this problem by modifying the Firefox configuration.

The solution is as follows:

1. Enter about:config in the address bar of Firefox browser, open the configuration page of Firefox

2, then search for dom.allow_scripts_to_close_windows After you find it, you will find that the default value of the configuration is false. Right-click the option, select Switch, and change the value to true. The related screenshots are as follows:

Off-topic: If there is a master This problem can be solved by JavaScript code, please leave a message, thank you! ! !

Copyright © Windows knowledge All Rights Reserved