cancel
Showing results for 
Search instead for 
Did you mean: 

onUnLoad event is not triggered from Portal

Former Member
0 Kudos

Hello,

The requirement is, when I close the window (which has a page loaded into it), the system should throw a confirmation message. For which, I have written a javascript onUnload event of the body tag in the jsp page which is embedded inside the iview/page. But this doesn't get invoked at all. Any idea?

Whereas the same code works as a separate html page.

Regards,

Rukmani

Accepted Solutions (0)

Answers (1)

Answers (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Rukmani,

you have to set the onUnload event in the top window. See http://www.thescripts.com/forum/thread89658.html and especially http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/body.asp for suggestions.

<i>"You can access the body element from script through the document object.

The window object for the body element can host event handlers for the onblur, onfocus, onload, or onunload events."</i>

Also check the unUnload documentation and the example for the named script additionally. Be aware the you have to refer the <i>top</i> window.

Hope it helps

Detlev

Former Member
0 Kudos

Hello Detlev,

Thanks for your reply. We were able to trigger the onUnLoad event, using EPCF. But the problem is

When we click on to the close icon (X mark) on the window, it closes the window and then gives the alert. But our requirement is, when the user closes the window, the system should show a confirmation msg and then based on the user input, it shud either close the window and retain the window.

We tried onBeforeUnLoad, but that doesn't work in EPCF. Kindly help

Regards,

Rukmani

detlev_beutner
Active Contributor
0 Kudos

Hi Rukmani,

I expect that you have used the functionality described in

Anyhow, the onBeforeUnload event isn't supported here, as you have already learned. So still the things I already referred to do hold, only that you now will use this different event.

The disadvantages Sven explained when using the event directy won't really matter, because the portal doesn't seem to use this event (otherwise EPCF would support it, I expect). Of course, this is not sure, so take care.

You could also try to use a named script, I'm not really familiar with this, but it looks like you could reach the same effect Sven described by this (defining different event handlers in parallel). Of course this will only work within IE.

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!