Browser windows in Firefox and Chrome to close the invalid solution _ basics

Source: Internet
Author: User
First of all, ie can be window.close () to close the browser window, but under Firefox and Chrome is not valid.

The reason is:

The default setting for Firefox is not to close the browser window through a script to prevent malicious scripting from being injected,

So the way to adjust is to enter about:config in the URL address bar,

Then find dom.allow_scripts_to_close_windows in the configuration list
Click on the right button to change the above false to true. Default is False

Chrome is not supported by default, but it can be closed by some special means:
Copy Code code as follows:

Window.opener=null;
window.open (', ' _self ');
Window.close ();

Create a window without the parent element, while pointing the window to itself, and closing itself, the last can be closed, in fact, a bit similar with the script opened the current page, and then use the script to close the current page, and this way in the consortium is recognized!

We can not ask customers to change the browser configuration, 99% of the people are using the default configuration, this method to solve the current (2014-01-16) most browsers can not close the current page problem, 10 years later do not know (this is nonsense, hehe).
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.