About JS using the Close method cannot close the Firefox browser

Source: Internet
Author: User

Today, a problem is that using the Window.close () method in JS cannot close Firefox:

Browser version:

Firefox

Ie

A simple code that enables the browser to close

1 <p onclick= "Javascript:window.close ()" > Close </p>

But the test found:

IE can pop up the window to ask whether to close the window

Firefox does not respond when clicked

Does Firefox not support close ()? We're going to test it. Can I close the open () window with close?

1 /*index.html*/2<script type= "Text/javascript" >3             functionop ()4             {5window.open ("test.html", "", "height=100,width=100");6             }7</script>8<p onclick= "OP ()" > Open </p>9 Ten /*test.html*/ One<p onclick= "Javascript:window.close ()" > Close </p>

Test results:

Firefox can close the open () window, but without any hint, ie can also shut down normally without any hint.

Conclusion: When using the Close method of window in Firefox, you should pay attention to his and ie different places: the page opened in the parent window is not available with close

There is no workaround for finding out through search engines:

Original address: Http://zhidao.baidu.com/link?url=ouKyYZa9KAfcEst4rYk-N-KjjugyxUo5wv6aEI6gzBxONKdWBdIF9BuAt_ E6dyj-ikiy8dysrnr1ue-3sqd-0_xg2sf5oqrgfam8i8jdghc

Enter About:config via the address bar into the Configuration page search Dom find dom.allow_scripts_to_close_windows set to True re-test and can be closed

But this does not feel satisfied, as said above, ask the customer also to set up a browser ah ....

What good solution, hope to leave a message below ...

About JS using the Close method cannot close the Firefox browser

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.