views:

2864

answers:

1

One of my pages launches a popup with javascript. Inside the popup there is a link that uses window.opener.location to redirect the parent window. I want the popup to wait until the parent window is completely loaded, and then close itself.

The link is to an external page, so using the parent window to close the child window is not an option. Using setTimeout to guess when the page has loaded is also not an option. Using frames within the parent window is also not an option because currently frames can bust out and I have no way of stopping them.

Thanks

+1  A: 

This won't be possible, as when you redirect the parent window to a different domain, you lose the ability to access it's properties and know when it's been loaded.

Josh
If I put an onload attribute on an iframe, it fires when an external page is loaded. Unfortunately, I have only gotten that to work if the attribute is inline. I'm thinking if I can figure out how to apply it in my <head>, I can have my popup apply the same snippet to window.opener.Is there any reason why that's not plausible? But how can I assign the onload event to an iframe without the inline "onload" attribute?Thanks
Colin
Oh, well, this is possible if you were using frames but your question clearly stated "Using frames within the parent window is also not an option because currently frames can bust out and I have no way of stopping them."
Josh
Can you think of a way to accomplish this with a site that busts out of the frame?
Colin