Jump to content

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.