IFrame on upload refresh parent page

I have an iframe on the page. When the iframe is closed, I want to refresh the parent page. Checking iframe element w3 page I see that there are no standard events.

I considered the polling approach, when the parent page constantly checked whether the frame was created, and then checked whether it was deleted and then updated, but this approach is small. I can imagine that sometimes there are delays between iframe close and page reload if polling is infrequent. With more frequent polling, the page will affect the "user experience" (twitching).

I am wondering if there is another approach that is not related to parent iframe messages.

+1
source share
1 answer

I do not understand why you will not use the parent-iframe relationship. Since everything happens on the page inside the iframe, and you just need to tell the parent page about it after that, the best way is to call the function on the parent page so that you can partially refresh the parent page without reloading the iframe. In this way:

window.parent.myFunctionInParent('my param');

You can gradually learn the technique in How to partially update the parent page from a page in an iframe .

Hope this helps.

+1
source

All Articles