Showing results for 
Search instead for 
Did you mean: 

BSP Window Closing Issue

0 Kudos

Hi All,

We are facing a issue in the BSP application u2018HAP_DOCUMENTu2019.

We are accessing a particular page of this application from portal (as a portal iView) and the page contains u2018Exitu2019 button, which does some functionality (Unlocking the appraisal document). We need to implement same functionality when the user closes the page using close button ( X ) of the browser window.

Currently we are not able to catch the window closing event of the browser/portal in the BSP page. We tried to use onUnload event, but for no success.

Any pointers on this is highly appreciated.

Thanks & Regards,


View Entire Topic
Active Contributor
0 Kudos


Some text from BSP application ITSM:

Usually it is not possible for the server to know when the user closes
the browser, or when the user navigates away onto another site. However,
by hooking the document.onUnload event, it is possible to know then this
document is unloaded. This event is also called when the window is closed.

So one idea would be to hook this event, to inform the server when the user
navigates away. Unfortunately, the same event is also fired when the user
navigates within the application from page A to B. So the document unload
event can not be used to catch these situation.

But a similar technique can be used. One starts the application inside a
wrapping frameset, where the onUnload event is hooked for the frameset. As
long as the navigation is done inside the application, this affects only the
containing frame, and not the frameset. So the unload event is not fired. When
the user navigates away or closes the browser, the frameset is unloaded, and
then the hook is triggered.

Such a wrapping frameset is not difficult to write. By why do the work, when
cut-and-paste code is available. Such an example page has already been written
in the BSP application SYSTEM, page "session_single_frame.htm". Just copy this
page into the application, and call it "default.htm". It *must* be copied into
the application, and must be the page from with which the application is
started. (The "session_buffered_frame.htm" does the same session management
with a frameset, but also shows an example of how a double buffer technique
can be used to achieve flicker-free rendering.)

When the unload is triggered, we must inform the server that the browser
is departing. This is very difficult to do in the current window, because
it is not possible to get access to the new target URL, so as to first make
a detour to the server before continuing on the way. So the trick is to
open a new window, which will handle the logoff operation. This new window
will close the current session at the server.

So i guess.. you have to use a wrapping frameset.