Skip to Content
avatar image
Former Member

onUnLoad event is not triggered from Portal


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.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 20, 2006 at 08:22 AM

    Hi Rukmani,

    you have to set the onUnload event in the top window. See and especially 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


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Rukmani,

      I expect that you have used the functionality described in eventing-browser-events-in-portal

      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


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