[Javascript] Can a reloaded parent window close its child?
Paul Novitski
javascriptlist at dandemutande.org
Sat Dec 27 17:18:17 CST 2003
Since the child can still see the parent, I'm trying to persuade the child
to monitor the parent's status and close itself if the parent changes
(reloads).
1) One approach I've tried is for the parent to contain a hidden input
object containing the date & time as stamped when the parent last
loaded. The child could keep checking this object and close itself when
the object changes value or disappears:
var ParentLoaded = window.opener.document.ParentForm.ParentTimestamp.value;
while (ParentLoaded ==
window.opener.document.ParentForm.ParentTimestamp.value){
}
window.close();
2) Another method might be for the child to watch for the UnLoad event in
the parent, e.g.:
window.opener.captureEvents(Event.UNLOAD);
window.onUnLoad = handleUnLoad;
function handleUnLoad(){
window.close();
}
Alas, I have not yet been able to get either of these techniques to work.
Paul
At 02:52 PM 12/27/2003, BEKIM BACAJ wrote:
>Sad but true, the child will recognise this new clone as his real parent
>and will interact wit him/her. Because both, the real father and the newer
>clone have same container origin. It will send a "message" to Mommy and
>will be able to ask her to freshen her memory, but it will do no good, the
>newer clone will never be able to recall the memory it never had. The
>connection will be llost because the real parent has vanished forever.
>But I will try to look into this matter later, if I come to any solution I
>will repply as soon as possible.
More information about the Javascript
mailing list