JavaScript Close window does not prompt to close dialog box

Source: Internet
Author: User

We know that the direct use of Window.close () is a shutdown prompt, the user experience is compromised,

Solving method

When the child window calls Window.close (), the dialog box will not pop up, so as long as the window is set to a pseudo parent window, IE will take the current window as a child window

The code is as follows

With Window.opener = NULL, you can

The code is as follows Copy Code
Do not prompt the window to close the dialog box
Parent.window.opener = null;
Parent.window.open ("", "_self");
Parent.window.close ();
Parent.window.location.href = "";
Window.close ();

Other methods

  code is as follows copy code

//normal with prompt close
function Closeie () {
Window.close ();
}

//Close IE6 not prompt
function closeie6 () {
Window.opener=null;
Window.close ();
}

//Close IE7 not prompt
function closeie7 () {
window.open (', ' _top ');
Window.top.close ();
}

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.