JavaScript does not prompt to close the current page window, compatible with IE/Firefox/chrome

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.