When close is used in ie to close a non-open window, a dialog box is displayed asking users how to remove this box. In window. add window before close. top. openernull is enough for everyone to know window. close () is used to close the window, and both ie and firefox support.
In order to achieve absolute control over the browser, a dialog box pops up asking the user how to remove this box when closing a non-open window with close in ie. See the following code.
function winClose(){ window.top.opener = null; window.close(); }
Add window. top. opener = null before window. close.
Some people say that firefox does not support close. In fact, this is an error. The reason why window. close cannot be used in firefox is that firefox cannot close the webpage opened by users by default. You can set firefox in this way.
Open firefox and enter about: config in the address bar.
Find dom. allow_scripts_to_close_windows and change it to true.
It must be said that there is no trouble to bring up a dialog box in firefox.
《script》function a(){window.open('','_parent','');window.opener = window;window.close(); }《script》
Run the command again to disable it in ff.
When we see this, if we ask the customer to set it, it means that this function is not done, so we are not satisfied with the results, and we do not know whether there are other good alternatives.
Note: you can close the current page by opening a new window and closing the page. Thank you, strangebank. However, it is strange that I did not succeed in the ff2 test yesterday. Today I succeeded in using 3. Today, I tried to use 2 on my colleague's machine. Now I can try again. But it is good to solve the problem early in the morning. Pai_^
Index.html
ddddddddd
C.html
Close Window