You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Raymond <pp...@hotmail.com> on 2005/04/29 13:09:03 UTC
close all child browser windows when parent closes
Hi people,
I need to do this in my application: close all child browser windows
automatically when the parent window closes or timeouts or the user logs
out.
I find it difficult or impossible to do with Tapestry because of the usage
of PopupLinkRender.
With ordinary web programming I could do it by some Javascript like this:
<script language="JavaScript"><!--
openWins = new Array();
curWin = 0;
function openWin(page) { openWins[curWin++] = window.open(page,'_blank'); }
function closeAll() {
for(i=0; i<openWins.length; i++) if (openWins[i] && !openWins[i].closed)
openWins[i].close();
}
//--></script>
But with the Tapestry framework it becomes quite complicated.
Any solution? Thanks.
Raymond
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: close all child browser windows when parent closes
Posted by Kent Tong <ke...@cpttm.org.mo>.
Raymond <pps18033 <at> hotmail.com> writes:
> With ordinary web programming I could do it by some Javascript like this:
> <script language="JavaScript"><!--
> openWins = new Array();
> curWin = 0;
>
> function openWin(page) { openWins[curWin++] = window.open(page,'_blank'); }
>
> function closeAll() {
> for(i=0; i<openWins.length; i++) if (openWins[i] && !openWins[i].closed)
> openWins[i].close();
> }
> //--></script>
Encapsulate the above logic into a component such as ChildWindowsTracker.
Then create a subclass of PopupLinkRenderer and override the constructURL()
method to generate Javascript to register the new window with the script
generated by ChildWindowsTracker.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org