Everyone knows that window.close () is used to close windows, and both IE and Firefox are supported.
In order to achieve the user's absolute control of the browser, ie in the closed open window with close to pop up a dialog box to ask users, how to remove this box, please see the following code.
function Winclose () {window.top.opener = null; Window.close ();}
It is OK to add Window.top.opener = null before window.close.
Some people say that Firefox does not support close, in fact, this is wrong, the reason why Window.close in Firefox can not be used, because the Firefox default can not shut down the user's open Web page, so set up Firefox.
Open Firefox, enter about:config in the address bar
Locate the Dom.allow_scripts_to_close_windows and change to true.
What you need to talk about is the hassle of not having a pop-up dialog box in Firefox.
<script>
function A () {
window.open (', ' _parent ', ');
Window.opener = window;
Window.close ();
}
</script>
Run this again and it will be closed under FF.
See these, if let the customer to set up, is equal to do not do this function, so said the result is not very satisfied, do not know if there is no other good alternative method.
PostScript: You can close the current page by opening a new window and then closing the page. Thank you, Strangebank. But the strange thing is that yesterday I did not succeed with the FF2 test, and today I succeeded with 3. What a heck of a thing, today on a colleague's machine with 2 to do the experiment, again. But it's good to solve the problem in the morning. ^_^
Index.html
<a href= "c.html" target= "_blank" >ddddddddd</a>
C.html
<a href= "Javascript:window.open (', ' _parent ', '); Window.close ();" >close window</a>