Page 1 of 1

giving commans to a parent window

Posted: Sun Jul 30, 2006 6:33 pm
by Charles256
Is there any way that when you open up a new window via javascript and that same window is closed is it possible to send a command back to the the parent window when it closes? i.e. after a page is viewed the status on the main page is going to change, i want to reflect this change as soon as the window is closed.this could be accomplished by simply refreshing the window but i want it dont automatically.make any more sense?

Posted: Sun Jul 30, 2006 6:38 pm
by feyd
window.opener is the reference to the parent of the window.

Posted: Sun Jul 30, 2006 8:06 pm
by Weirdan

Code: Select all

<script type='text/javascript'>
window.addEventListener('load', function(e) {
   window.addEventListener('unload', function(e) {
      window.opener.Func();
   }, false);
}, false);
</script>
This is pop-up window. When it's closed (or reloaded) it would run the Func function in the context of its opener

Posted: Sun Jul 30, 2006 8:27 pm
by Charles256
<body onUnload='window.opener.location.reload(true)'>

tada :-D