You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sunilmanu <su...@gmail.com> on 2007/01/03 17:01:15 UTC

standardized way of detecting Window Close event in IE & Firefox ?

Hi everyone,

In my tapestry application I am opening a Child window from parent window
and on closing the child window I need to set some hidden values on Parent
page and refresh the parent page.

I have this script that fires on Body unload but works only in IE,

function closePreviewMode() {

// check to ensure window is not closed while navigating from page A -> B
if (window.event.clientX < 0 && window.event.clientY < 0) { 
    // parentwindow close and set values
 }
}
....

<body id="index_contactus" class="hasLeftColumn" onUnload="return
closePreviewMode()">

Has anyone done anything to make it work on Firefox also ? Am I doing
something wrong.

Is there any standardized way of detecting the Window close() event for IE &
Firefox ?

Thanks in advance for all the help.

- Sunil M

-- 
View this message in context: http://www.nabble.com/standardized-way-of-detecting-Window-Close-event-in-IE---Firefox---tf2914290.html#a8143238
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: standardized way of detecting Window Close event in IE & Firefox ?

Posted by sunilmanu <su...@gmail.com>.
Hi,

I could solve the problem... 

- onBeforeUnload /onUnload is not good if we need to navigate within the
pages of the newly opened window. If you navigate from Page A -> B in the
same window, it causes to fire the unload event.

So I open the new window in an IFRAME and do the logic onUnload of a Body in
the window containing the Iframe and it works..

Thanks once again..

- Sunil



Davor Hrg wrote:
> 
> try
> <body onbeforeunload="" ...
> instead
> 
> 
> On 1/3/07, sunilmanu <su...@gmail.com> wrote:
>>
>>
>> Hi everyone,
>>
>> In my tapestry application I am opening a Child window from parent window
>> and on closing the child window I need to set some hidden values on
>> Parent
>> page and refresh the parent page.
>>
>> I have this script that fires on Body unload but works only in IE,
>>
>> function closePreviewMode() {
>>
>> // check to ensure window is not closed while navigating from page A -> B
>> if (window.event.clientX < 0 && window.event.clientY < 0) {
>>     // parentwindow close and set values
>> }
>> }
>> ....
>>
>> <body id="index_contactus" class="hasLeftColumn" onUnload="return
>> closePreviewMode()">
>>
>> Has anyone done anything to make it work on Firefox also ? Am I doing
>> something wrong.
>>
>> Is there any standardized way of detecting the Window close() event for
>> IE
>> &
>> Firefox ?
>>
>> Thanks in advance for all the help.
>>
>> - Sunil M
>>
>> --
>> View this message in context:
>> http://www.nabble.com/standardized-way-of-detecting-Window-Close-event-in-IE---Firefox---tf2914290.html#a8143238
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/standardized-way-of-detecting-Window-Close-event-in-IE---Firefox---tf2914290.html#a8165056
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: standardized way of detecting Window Close event in IE & Firefox ?

Posted by Davor Hrg <hr...@gmail.com>.
try
<body onbeforeunload="" ...
instead


On 1/3/07, sunilmanu <su...@gmail.com> wrote:
>
>
> Hi everyone,
>
> In my tapestry application I am opening a Child window from parent window
> and on closing the child window I need to set some hidden values on Parent
> page and refresh the parent page.
>
> I have this script that fires on Body unload but works only in IE,
>
> function closePreviewMode() {
>
> // check to ensure window is not closed while navigating from page A -> B
> if (window.event.clientX < 0 && window.event.clientY < 0) {
>     // parentwindow close and set values
> }
> }
> ....
>
> <body id="index_contactus" class="hasLeftColumn" onUnload="return
> closePreviewMode()">
>
> Has anyone done anything to make it work on Firefox also ? Am I doing
> something wrong.
>
> Is there any standardized way of detecting the Window close() event for IE
> &
> Firefox ?
>
> Thanks in advance for all the help.
>
> - Sunil M
>
> --
> View this message in context:
> http://www.nabble.com/standardized-way-of-detecting-Window-Close-event-in-IE---Firefox---tf2914290.html#a8143238
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>