Wednesday, June 18, 2008

How to refresh parent window when closing popup window

You open a popup and when a update done in popup window you need to refresh or reload the parent window. How can you reload or refresh your parent? here's how its done.


window.close(); // close the popup

if (window.opener && !window.opener.closed)
{
//if parent available
window.opener.location.reload(); //reload parent
}


 Subscribe To My Blog

3 comments:

  1. If a popup window is opened from a frame, this code only refresh that frame, not the whoel page. How can we make him refresh every frame, or parent whole page?

    ReplyDelete
  2. btw top.document.frames["frameName"].location.reload();
    is not working

    ReplyDelete
  3. Hi, I'll try to find a solution, if I find one I'll post it here

    ReplyDelete