cancel
Showing results for 
Search instead for 
Did you mean: 

Catch window close event in Dynpage

Former Member
0 Kudos

Hi all,

I have a JSPDynPage. When the window is being closed I need to receive the window close event. Does anybody know how to get this? I thought to overwrite something like the dispose()-method.....

Thanks and kind regards

Martina

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Martina,

this is a known issue... There is no direct solution but a set of workarounds, via a third window, via a (non-visible) applet... For example discussions, see or http://forums.devshed.com/archive/t-43865

Hope it helps

Detlev

detlev_beutner
Active Contributor
0 Kudos

Hi Martina,

just got this, I think that's the best...

<html>
<body onunload="doUnload()">
<script language="javascript">
  function doUnload() {
    if (window.event.clientX < 0 && window.event.clientY < 0) {
      window.open("http://www.google.de");
    }
  }
</script>
test
</body>
</html>

You task would be (a) to get this onunload into the body tag - this means to have the window built up by an AbstractPortalComponent, maybe including some content within an iFrame (just a fast shot). And (b) to call the server-side component you want to react on the close event, which returns a short html which closes itself again immediately (this could be a JSP(DynPage) or whatever).

Hope it helps

Detlev

Answers (2)

Answers (2)

Former Member
0 Kudos

Guys,

I've been playing around and I can now pick up the unload event in my JSP:

<SCRIPT LANGUAGE="JScript" TYPE="text/javascript">

window.onbeforeunload=Save;

</script>

"SAVE" is a JS function that I have in the HEAD section of my JSP.

Now I need to call a function module back in the Java or raise an event. How can this be done?

Thanks

Tahir

Former Member
0 Kudos

Hi Tahir,

I am just wondering if you ever finds any solution to raise server event using javascript? I need to do the same thing, please let me know if you found the solution.

Thanks in advance.

Ti.

Former Member
0 Kudos

Hello Detlev,

I am trying to achieve the same thing...registering the unload event in a JSPDynpage.

First off I've noticed that onunload cannot be put into a body tag in the JSP...it just does not notice it!

Second, I've tried the DOM script window.unload event but this also does not seem to work properly.

Can you please elaborate on your suggestion above. It uses unload in the body tag but as I've said the JSP does not allow this. Or have I missed something.

Thanks

Tahir

detlev_beutner
Active Contributor
0 Kudos

Hi Tahir,

this is why I wrote "body tag - this means to have the window built up by an AbstractPortalComponent". Maybe Martina figured out an alternative way...

Hope it helps

Detlev

Former Member
0 Kudos

Have you tried this :


<script type="text/javascript">
   window.onunload = function() {
      ...
   }
</script>

I used this in a modified version of the masthead iView to logoff users when they close the portal browser.