Copy link to clipboard
Copied
Hi all, I have a session time out warning message which warn the users in the 3.minute of session...but somehow it doesnt function...Any input appreciated...
my application.cfm:
<html>
<head>
<script language="JavaScript1.2">
function startTimer()
{
//myTime = setTimeout('ding();',60000);
myTime = setTimeout('ding();',180000); // at the 3.Minute
// (60000 ms in a minute, * 14)
}
function ding()
{
nwindow1=window.open("WarningTimeOut.cfm","","height=140,width=585,left=200,top=180,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no",bReplace="true");
//alert('dinner is served!');
}
function ajx()
{
if (typeof window.ActiveXObject !='undefined' )
{ xmlDoc =new ActiveXObject("Microsoft.XMLHTTP"); }
else
{ xmlDoc =new XMLHttpRequest(); }
var myRand =new Date().getTime();
var myPage ='application.cfm?stamp='+ myRand;
xmlDoc.open( "GET", myPage, true );
xmlDoc.send( null );
//alert("HI");
window.opener.focus();
if (window.opener.nwindow1)
{window.opener.nwindow1.close();}
}
</script>
</head>
Copy link to clipboard
Copied
I did not attempt to study your code too closely, but this is what I do...
I set up a timer to go off continuously, say every 30 seconds or so. And what it would do, in the case of a 3-minute timeout, is to increment a variable. If the variable's value becomes "5," a warning message is displayed to the effect that the session will time-out in 30 seconds.
Meanwhile, there's another little function that's called at strategic places throughout the code, and what it does is to reset that counter to zero. We call this function anytime we do anything useful. (There is a function to do this... we don't diddle with the counter directly, everywhere in our code.)
Now, this of course is an "inactivity timer," but that's basically how session-management typically works: the session dies after so-many minutes of inactivity.
The timer doesn't stop running.
Copy link to clipboard
Copied
Thank you...do you have a sample?
Copy link to clipboard
Copied
Nope, but they're out there. Google it. The idea isn't exactly original . . .