[Chameleon] Close popups when main window closes

Bart van den Eijnden BEN at Syncera-ITSolutions.NL
Tue Dec 13 10:24:39 EST 2005


Hi Berend,

I think this would be a nice addition.

I can't answer your questions, but I just wanted to point you to a related bug discussion:

http://bugzilla.maptools.org/show_bug.cgi?id=171

Best regards,
Bart

Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG  DELFT

tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl

>>> Berend Veldkamp <berend.veldkamp at aris.nl> 12/13/2005 4:10:04 PM >>>
Hi,

I'd like to close any popup when I close the main application window, so 
I changed CWCPopup->DrawPublish() to include the following Javascript:

var wh = window.open('{$url}', '{$name}', '{$options}');
if (!wh)
{
   alert( 'unable to open popup dialog.  Perhaps you have a popup 
blocker installed?' );
}
else
{
   if (window.opera) // Opera
     window.opera.addEventListener("BeforeEvent.unload", 
function(){wh.close()}, false);
   else if (window.addEventListener) // W3 DOM
     window.addEventListener("unload", function(){wh.close()}, false);
   else if (window.attachEvent) // IE
     window.attachEvent("onunload", function(){wh.close()});
   wh.focus();
}

This works for IE and W3 DOM compliant browsers, but not Opera, can 
anyone tell me what I do wrong?

And another thing: With this approach, the Javascript code is duplicated 
for each popup that I use, is it possible to include this only once, as 
a separate function?

If I get this working, would it be possible to include this in the main 
Chameleon distribution, so I don't have to change my own application 
after an upgrade?

Thanks, Berend


-- 
____________________________

Berend Veldkamp - ARIS
http://www.aris.nl/ 
____________________________
_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org 
http://lists.maptools.org/mailman/listinfo/chameleon




More information about the Chameleon mailing list