JavaScript does not prompt to close the current page window, compatible with IE/Firefox/chrome (close the current page window without confirm by JavaScript, support all browsers)
Tests passed in IE7/Firefox 3.0/Google Chrome
Closedemo.htm
CopyCodeThe Code is as follows:
<SCRIPT>
VaR browsername = navigator. appname;
If (browsername = "Netscape ")
{
Function closeme ()
{
Window. Open ('', '_ parent ','');
Window. Close ();
}
}
Else
{
If (browsername = "Microsoft Internet Explorer ")
{
Function closynoshowsme ()
{
Window. Opener = "whocares ";
Window. Close ();
}
}
}
</SCRIPT>
<Input type = "button" value = "close me 3" onclick = "closeme ();"/>
note: "
if you are using the Firefox browser, you must make the following Settings
1. Enter about: config in the address bar and press Enter, warning confirmation
2. Enter "dom" in the filter. allow_scripts_to_close_windows ", double-click to set this value to true
.
the test code is better: