Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing for open popup window

Status
Not open for further replies.

rhowes

IS-IT--Management
Jun 6, 2001
140
ZA
Hi All

I have an application using IE only as the client. The app sometimes opens popup windows for various reasons/functions. I open the popup with this ('xpopup' is a global JavaScript variable):

xpopup = window.open(url,"",features);

On closing the popup I set xpopup to false. On closing the main window I test for an open popup window and if there is one I close it with this code:

function window.onunload(){
if(xpopup){
xpopup.close();
}
}

I also have code to make the popup modal (On focus of main window I test xpopup and if it is set I focus the popup).

I know I can open a modal window in IE but I don't want to use IE only features if possible (I do already and I am trying to remedy that).

So my questions:

1. Has anyone else implemented a generic 'modal' popup solution?
2. Is there a better way to test for an open popup, i.e. child window? (If I forget to reset xpopup to false when a popup closes then a 'focus' on the main window tries to focus the popup, which is closed, and I get an error. Also handling a popup from a popup is problematic (nested popups).)

Thanks
Cheers

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top