JS implementation Refresh the parent page does not pop-up prompt box method _javascript tips

Source: Internet
Author: User

This article describes the JS implementation to refresh the parent page does not pop-up prompt box method. Share to everyone for your reference, specific as follows:

A page open way out b page, when the B page does a class such as Save action, need to close B page, refresh a page, will pop up a prompt box, ask for a try, this is unexpected situation, the user experience is very poor.

The solution is divided into two scenarios:

1, a page is very simple situation (no frame/iframe)

In the function in page B:

function Close () {
 window.opener.location.reload ();
 Window.opener = null;
 window.open (', ' _self ');
 Window.close ();
}

It's OK.

2, a page element is a bit complex, with frames, etc.:

Requirements: b page to refresh the page a

In the function in page b, call the function directly in page A, take the most common A as List page, and b for the new page:

A page has a query button, you can find all the list, we are in the B page to trigger this function can be:

function Close () {
 window.opener.queryAll ();//queryall () query function window.close () for page A ()
 ;
}

Note that if frame a on the same page jumps to Frameb, not with opener, but with parent

More readers interested in JavaScript-related content can view the site topics: "JavaScript switching effects and tips summary", "JavaScript Search Algorithm Skills Summary", "JavaScript animation effects and tips summary", " JavaScript error and debugging skills Summary, JavaScript data structure and algorithm skills summary, JavaScript traversal algorithm and skills summary and JavaScript mathematical calculation usage Summary

I hope this article will help you with JavaScript programming.

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.