JS Close window (Cancel prompt)

Source: Internet
Author: User

From: http://blog.sina.com.cn/s/blog_8f49f0060100x48v.html statement: This article mainly for IE browser description generally close the page (or close the window), we first think of is Window.close () , but this code is very effective for Windows created with window.open (), there is no hint, and when used in the main browser window, you will get a hint: Prompt the script view to close the window and ask if you really want to close the window, which is sometimes annoying.

The following methods are available: (1) Use the following code in IE6 to avoid prompting information function Closewin () {Self.opener = Null;self.close ();} (2) Use the following code in IE7\IE8 to avoid prompting information function Closewin () {window.open (', ' _top '); Window.top.close ();} (3) In order to be common in IE, the following methods are easy to use.    function Closewin () {Self.opener = Null;self.open (' ', ' _self ') (because no IE7 environment has yet been tested); Self.close (); }ps: (1) Self and window are equivalent (2) The above methods can be used in Firefox and other browsers (3) in Firefox and other browsers directly using Window.close () does not prompt whether to close the page information

JS Close window (Cancel prompt)

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.