Javascript – How to refresh parent window from an iframe

iframejavascript

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.

Best Solution

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).