Skip to Content
Former Member
Aug 18, 2009 at 08:44 AM

Terminating portal session in a child window when hitting X in the browser


Terminating portal session in a child window


We have placed a link to the portal in many of our internal websites and few users have highlighted this scenario:

1. User A clicks on a link on the parent window to open the portal in a new child window.

2. The user logs in, do some things and then closes the window by pressing the X and without logging off.

3. User B then uses the same computer and the same parent window to click on a link to the portal.

4. User B will be still logged in using User A credentials.

I know that this scenario is not standard and I know that users should properly log off the portal before they close the window but the matter of fact is that users are using shared computers and almost never log off properly.

Now, the reason for this problem is clear - The child window uses the buffer of the parent window to save its session cookies. Unless the child window properly logs off to clear them or the parent window completely closes to terminate them then these cookies will remain.

My idea to resolve this was adding the a JavaScript code to the standard masthead and handle window.onunload event.

In this event I open a new window that triggers a request to the SAP satandard logoff module on:


This works well with one problem - The onunload event is triggered when the user refreshes the browser as well (and therefore logs the user off) but there is no JavaScript event to handle a browser refresh and by that differentiate between these two events.

Anyone has a better idea on how to tackle the refresh problem or solve the X problem in a different way?