Is it possible for parent window to notice if child window has been closed ???
Posted
by
masato-san
on Stack Overflow
See other posts from Stack Overflow
or by masato-san
Published on 2011-01-17T01:49:50Z
Indexed on
2011/01/17
1:53 UTC
Read the original article
Hit count: 477
JavaScript
|popupwindow
I have parent window (opener)
and child (popup)
---------- --------------
| | | |
| parent | -----> opens popup | child |
| | | |
----------- --------------
Let's say, in parent page, I have js function hello()
In order for child to call parent's hello() when the child window is closed and also pass an argument, I can do,
window.close();
window.opener.hello(someArgument);
This will close the window and also call parent's hello();
But what if I don't want to have the code window.opener.hello() in child page? I mean I want the code to be in parent page only
One thing I can think of is:
Somewhat parent knows when the child is closed (event listenr??? not sure in js) But in such case how to receive the argument? (i.e. some data back from the child)
© Stack Overflow or respective owner