Skip to Content
author's profile photo Former Member
Former Member

Capturing browser close event

Hello everyone,

Even though this question has been answered before, I find that none of the answers seem to work for me.

My problem is the following: Locks are placed on records and tables at certain points in my application. But if the user simply closes the browser without closing the application properly, all the locks are still in place. So I need to catch an event that allows me to ABAP my way out of this.

I have the following BSP page which loads my application:

function startBSPApplication()

function endBSPApplication()

<frameset id="<%=guid %>_FRAMESET" rows="*,0" onload="startBSPApplication('<%=guid %>_A');" onunload="exitBSPApplication();" noresize framespacing="0" frameborder="0" border="0">


<noframes>This browser does not support frames.</noframes>


The start and end functions simply start and end a session, and I find myself unable to actually call an ABAP function in there. All ABAP code placed inside the javascript functions is called everytime the page is loaded, not everytime the function is called and that's not what I want.

I also already tried the <bsp:htmlbEvent> tag, but I couldn't get that to work either. I tried it like this:

Notice however that I wrote this on top of the frameset. Does this mean that the onunload event will be called twice and does this cause a problem?

I tried to call the onDestroy event from within my endBSP function, but nothing happened either.

<htmlb:content design="design2003" >

<htmlb:page title="Capture browser close " >


<bsp:htmlbEvent id = "myid"

onClick = "onDestroy"

name = "onDestroy"/>

<script for="window" event="onunload" type="text/javascript">

alert('Starting the Server Event');






Does anybody have another suggestion, or notice me overlooking something?

Thank you in advance,


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jun 16, 2006 at 09:47 AM


    Pls check this web log:



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.