Jump to content

check if window exists.


mad_php

Recommended Posts

Hi,

 

I have two windows i'm working with. When window B opens off the parent window A. Window A has to be open all the time while window B is open. If the user closes down window A, window B need to close also.

 

I have a javascript function inside Window A that is launched on the onunload event.

 

function closePopup(){

main.close(); 
    
}

 

main is the name of window B. I keep getting error message when i load window A, it says main is undefined. So basically I want to be able to check to see window B is open before running main.close()

 

Can anyone help me?

 

Thanks

 

--Mark

 

 

Link to comment
https://forums.phpfreaks.com/topic/127238-check-if-window-exists/
Share on other sites

Hi,

 

I have two windows i'm working with. When window B opens off the parent window A. Window A has to be open all the time while window B is open. If the user closes down window A, window B need to close also.

 

I have a javascript function inside Window A that is launched on the onunload event.

 

function closePopup(){

main.close(); 
    
}

 

How are you opening the main window (Window B)?  Because at first blush, it sounds like you may have a slight runtime collision on your hands, where references to HTML elements are trying to be created before they actually exist in the browser.

 

main is the name of window B. I keep getting error message when i load window A, it says main is undefined. So basically I want to be able to check to see window B is open before running main.close()

 

Can anyone help me?

 

Thanks

 

--Mark

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.