First of all, IE can close the browser window through Window.Close (), but it is invalid under Firefox and Chrome.
The reason is:
The default settings under Firefox cannot be closed by the browser window through the script to prevent the injection of malicious scripts.
So the adjustment method is to enter an About: config in the URL address bar,
Then find dom.allow_scripts_to_close_windows in the configuration list
Click the right -clicking switch to modify the above false to true. The default is false
The default under Chrome does not support this closing method, but it can also be closed through some special means:
Copy code code as follows:
Window.opner = null;
Window.open ('', '_ Self');
window.close ();
Create the window of the parent element, at the same time point the window to itself, close itself, and finally close it. In fact, it is a bit similar to opening the current page with the script, and then close the current page with the script. Intersection
We cannot ask customers to change the browser configuration. 99%of the people use the default configuration. This method can solve most of the current (2014-01-16) browsers cannot turn off the current page problem. (This is nonsense, hehe).