JavaScript IFrame Force-Refresh Code _javascript Tips

Source: Internet
Author: User
When the first entry from the main window into an iframe abbreviation {a}, at this time the data presented in this {a} is new, and then I point to another iframe abbreviation {b}, here {b} data is also new, in {B} in some logical processing, such as to {A} in bulk increase model data, Here we go into {a} and we find that the data is cached. Because the data from {A} has been manipulated in bulk from {B}, {b} is communicating with the server, that is, the logical layer/persistence layer operation, so that the rendering portion of the server-side update is {b} instead of all, which is the local flush, only the {b}. What we need to do is to change the contents of {A}.

Solution:
• obviously Iframe.window.location.reload (); does not meet current requirements.
• Use Window.settimeout (Iframe.window.loadction.reload (), 1000); This will cause multiple refreshes, if you want to update {B} data in {A}?
* Research for half a day, in fact, can directly from the problem of the IFRAME cache to solve, very easy, directly do not let it cache is over, do not cache, of course, there is no need to refresh.
Example:
Copy Code code as follows:

function Doinsert2batchcallback () {
var pIf = parent.document.getElementById (' iframe_a ');
PIF.SRC = pif.src + "&". Concat (Math.random ());
Submitting Bulk Import Requests
}

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.