0

From a parent windows I create a pop-up windows (the child):

onclick=window.open('child_windows.html','popup','width=600,height=300')

On the child window I've got a nifty feature that will update the parent window when I close the child window:

window.onunload = refreshParent;
function refreshParent() {
    window.opener.location.reload();
}

This works good. Now I created a link (href) on the child window to a new page, which is still on the same webserver, within the same directory. It's just a new page. Let's say:

<a href=second_page.html>click here</a>

I copied the window.onunload code to this new child window, but when I close this new child window the original parent window does not refresh. Is there any way to achieve this?

Roy
  • 31
  • 4

1 Answers1

0

when you open new window, current window automatically closes itself and then refreshes the parent window.

<script type="text/javascript">
   var localWondow;
   function doLoad() {
   localWondow = setTimeout("window.close()",1000);
   }

   function refreshAndClose() {
     window.opener.location.reload(true);
     window.close();
   }
</script>
<body onbeforeunload="refreshAndClose();" onLoad='doLoad()''>

For more info:- Click me

Parth Raval
  • 4,097
  • 3
  • 23
  • 36
  • I clicked your link for more info, but that information is for the simple parent - child window. My question is, I have a parent window which opens a child window, from the child window I link to a new page, and when that new page is closed I want to refresh the original parent window. – Roy Jan 03 '18 at 12:34