[Javascript] popup window close

Hakan Magnusson hakan at backbase.com
Thu May 13 10:26:59 CDT 2004


Suppose you're changing the location of the parent through the child 
(top.opener.window.location = 'yournewlocation.htm';) you might also be 
able to set events on the parent.

This is untested and I'm just shooting from the hip, but give it a try.

In your popup window:

// Reference to the popup window
var oPopup = self;
// Change location
top.opener.window.location = 'newlocation.htm';
// Add the variable referencing to the popup to the parent
top.opener.window.oPopup = oPopup;
// Add the event handler for the parent
top.opener.window.onload = function() { oPopup.close(); };


Hope it works.

Regards,
H

Paul McGuire wrote:
> I have a real problem I cant get round.
> 
> I have PageA.htm and PageB.htm
> 
> PageA.htm is a form and onsubmit I open a popup window which displays a
> please wait... message.
> 
> PageB.htm take about 3 mins to load and as I want the please wait.... window
> stays open.
> 
> However on the onload handler of PageB.htm I want to close the window. I
> cannot get a handle on the popup once the original window opener has gone.
> How do I reference this popup in a new page?
> 
> PLease PLaease somebody put me out my misery!
> 
> Paul
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list