using AJAX to detect Browser close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I see a lot of posts claiming that you can use AJAX or Javascript to run some
kind of "heartbeat" " server polling" that tells the server that the page is
still open. I need to know how exactly to do this (server side and client
side) or where I can find information on doing this. I want to run some code
after a page is closed and I don't want to wait for the session timeout.

if anyone has information please post explanations, code samples, or links.

thanks
 
Hi,
I see a lot of posts claiming that you can use AJAX or Javascript to run some
kind of "heartbeat" " server polling" that tells the server that the page is
still open. I need to know how exactly to do this (server side and client
side) or where I can find information on doing this. I want to run some code
after a page is closed and I don't want to wait for the session timeout.

if anyone has information please post explanations, code samples, or links.

thanks

Th<e "heartbeat" implementation relies on the fact that every request to
active content (which includes web services) extends the session. So if
you have a web client continuously "pinging" the web server using web
services, the session never dies. However, if the web client is closed,
the "pinging" stops, and 20 minutes later (or whatever the session
timeout is set to), the session expires.

We use this in our web application and it works fine. We managed to have
sessions lasting two weeks and more without too many side effects.

HTH,
Laurent
 
Back
Top