J
joey.powell
Hey guys I have some js code as follows...
-------
var SessionTimer;
function StartSessionTimer()
{
SessionTimer = setTimeout('RedirectToSessionTimedOutPage(),60000)
}
function RestartSessionTimer()
{
clearTimeout(SessionTimer);
StartSessionTimer();
}
function RedirectToSessionTimedOutPage()
{
window.location = '/SessionTimedOut.html';
}
-------
When I load the page and call StartSessionTimer(), I know it works
because the page redirects after ten minutes (the value of 60000).
However, in certain situations I need to be able to call back to the
server with AJAX and then have the timer reset - that's when I call
the RestartSessionTimer() function. When I do this, for some reason
the ten minute window does not get reset.
To troubleshoot, if I remove the second line in the
RestartSessionTimer() function the redirect is getting blocked (as
planned). However, when I put the second line back in, the page just
redirects as originally called - the SessionTimeout value is never
reset properly.
The code above looks good to me, but for some reason the
SessionTimeout var does not get reset in the RestartSessionTimer
function; it retains its original value?
How can I fix this?
Please help.
JP
-------
var SessionTimer;
function StartSessionTimer()
{
SessionTimer = setTimeout('RedirectToSessionTimedOutPage(),60000)
}
function RestartSessionTimer()
{
clearTimeout(SessionTimer);
StartSessionTimer();
}
function RedirectToSessionTimedOutPage()
{
window.location = '/SessionTimedOut.html';
}
-------
When I load the page and call StartSessionTimer(), I know it works
because the page redirects after ten minutes (the value of 60000).
However, in certain situations I need to be able to call back to the
server with AJAX and then have the timer reset - that's when I call
the RestartSessionTimer() function. When I do this, for some reason
the ten minute window does not get reset.
To troubleshoot, if I remove the second line in the
RestartSessionTimer() function the redirect is getting blocked (as
planned). However, when I put the second line back in, the page just
redirects as originally called - the SessionTimeout value is never
reset properly.
The code above looks good to me, but for some reason the
SessionTimeout var does not get reset in the RestartSessionTimer
function; it retains its original value?
How can I fix this?
Please help.
JP