1.open.html
<SCRIPT type = "text/JavaScript">
<! --
Function OpenWindow (){
Window. Open ("new.html", "newwindow", "width = 200, Height = 100, toolbar = No ");
}
// -->
</SCRIPT>
<A href = "#" onclick = "OpenWindow ()"> open a new window </a> <br/>
<A href = "new.html" target = "_ blank"> hyperlink opens a new page in a new window </a> <br/>
<A href = "new.html" target = "_ parent"> the hyperlink opens a new page in the parent window. </a>
2.new.html
<A href = "javascript: window. Close ()"> close the window </a>
<A href = "javascript: Self. Close ()"> close the window </a>
You can use the open method and open in "_ blank" to close it in a new window, but the open in "_ parent" is still disabled in Firefox.
Now
Therefore, when using the close method of window in Firefox, you should note that it is different from IE: The page opened in the parent window cannot be closed.
Method.
Then I went to Google to search for it. The reason why window. Close is not available in Firefox is that Firefox cannot close users by default.
You can set Firefox as follows:
Open Firefox and enter about: config in the address bar.
Find Dom. allow_scripts_to_close_windows and change it to true.
Now you know why. The article has a good article, which is excerpted as follows:
As we all know, in Javascript, window. Close () is used to close the window, and both IE and Firefox support it. To achieve
Users have absolute control over the browser. When close is used in IE to close a non-open window, a dialog box is displayed asking users. Sometimes I
We don't want to do this again, but how can we remove this box and use the following code?
<Script language = "JavaScript" type = "text/JavaScript">
Function closewindow (){
Window. Open ('', '_ parent ','');
Window. Close ();
}
</SCRIPT>
<A href = "javascript: closewindow ();"> Close Window </a>