Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I refresh parent window from an iframe?

I've got a parent page and an iframe inside that page. The links in the parent control the page that gets loaded in the iframe. What I want to do is refresh the parent page when the iframe gets loaded. I've got this in the iframe:

RefreshParent(){
    parent.location.reload();
}

<body onload="RefreshParent();">

But, the above code refreshes the whole parent page along with the iframe inside it which in turn reloads the parent page and goes into an infinite loop.

like image 551
jkm Avatar asked Jan 29 '09 17:01

jkm


1 Answers

You can't refresh the parent page without reloading the iframe.

What you could do is use AJAX to update the parent's content, but that could be a fair amount of work (using the jQuery or Prototype frameworks would make this easier).

like image 190
Greg Avatar answered Oct 01 '22 21:10

Greg