Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capture closing of the window.

Status
Not open for further replies.

25884

Programmer
Mar 12, 2001
46
AP
hi
i am trying to invalidate a session on closing of a window.
this also involves updating a table row in my data base.
Is there a way i can capture the closing of the window(explicitly--the clicking of the cross?)..and then write soma java code to update the table on the event capture?
thanx.
Sonali.
 
You may need to use a frameset with a hidden frame (name it hidden) for processing.

<script>
document.body.onunload=function(){parent.hidden.location='logout.asp'}
</script>

This should work most of the time. jared@eae.net -
 
I guess window.onUnLoad might help you.
Ex: <body onUnLoad=&quot;EndSessionFunction()&quot;>

You can put your DB update and other end session functions in the EndSessionFunction code. The code will execute if they leave that page, and I'm almost positive if they close the browser window too, but you may need to test it out.

There is also window.closed which will return a boolean value, true if it has been closed already, false if not. Seems like you need to do some calculations after that on the same page though, so I'm not sure if that one will help.

thessa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top