using AJAX to detect Browser close

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
 
L

Laurent Bugnion, MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top