Session timeout

  • Thread starter Thread starter Alvin Bruney
  • Start date Start date
A

Alvin Bruney

I'd like to prompt the user that their session is about to time out and give
them the option to keep the session alive. Any ideas?

By the time the session end event fires, the session is already ended so
putting up a javascript box won't make sense since there is no session.

I thought of client side which is good in theory but the only thing i could
find was setwindow timeout and it does not measure inactivity, it is a sleep
function.
 
i've figured out a way to do this. posting the code for newsgroup benefit

<body onmousedown = "window_activity()" onkeypress="window_activity()">
<script>
var timerPROMPT = 0;
var timerCLOSE = 0;

function EndApp(){
RateDeck.style.display = "none"
spDeck.style.display = "none"
}
function StopTiming(){

if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)

if (confirm('Due to inactivity, your session is about to time out.')
== 1)
{
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)

timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",8000);
}
else
{
EndApp();
}
}
function window_activity() {
if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)

timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",6000);
}
 
Back
Top