I am trying to create a Auto Logout page for my application. I am using Javascript to handle the timer with classic asp. I have three pages the js script page, the home page where I call the js file and start the timer using OnLoad(). After 4 seconds a window pops up to ask the user to continue there session. But when the window pops up and I click yes on the logout_alert.asp page it doesn't update the timer on the home page. How can I get the popup window to update the timer? The following are the scripts.
Thanks for your help in advance,
Frank G.
I have three pages. For this example Page 1, Page 2, and Page 3.
PAGE 1 = logout_timeout.js
Here is the script for this page.
<!-- Begin
var c=0;
var t;
function ClockCount(){
c=c+1;
//Show the clock value on the home page text field.
document.timerform.clock.value = c;
if (c == 7) {
//The user never responded so we will kill the session and log them out.
alert("Your session has timed out you are logged out.");
window.location.href = "logout.asp"
}
else if (c == 4) {
//We will popup a window to let the user know there about to be logged out.
//This will give the user a chance to keep the session alive.
logoutalert = window.open("logout_alert.asp", "logoutalert", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=420,height=145,left = 465,top = 250");
}
//The timer will go round and round while recalling this function.
t = setTimeout("ClockCount()",1000);
}
//Call to start the timer.
function StartClock() {
ClockCount();
}
//Called to stop the timer.
function StopClock() {
c=0 //Clear the timer.
clearTimeout(t); //Stop it.
}
// End -->
PAGE 2 = homepage.asp
This page I call the logout_timeout.js file to.
<script src="logout_timeout.js" type="text/javascript"></script>
<body OnLoad="StartClock()">
This will show our clock while its processing.
<form id="timerform" name="timerform" method="post" action="">
<input type="text" name="clock" id="clock" />
</form>
Used now just for testing!
<input type="submit" name="continue" id="continue" value="START" onClick="StartClock()" />
<input type="submit" name="continue" id="continue" value="STOP" onClick="StopClock()" />
PAGE 3 = logout_alert.asp
This page pops up to notify the user that they are about to be logged out.
<script src="logout_timeout.js" type="text/javascript"></script>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Thread_Title">SESSION TIMEOUT Alert!</td>
</tr>
<tr>
<td width="85%" class="DataRows">Your session is about to timeout. Would you like to continue using WOTTS?</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><form id="timerform" name="timerform" method="post" action="">
<input type="text" name="clock" id="clock" />
</form></td>
</tr>
<tr>
<td>
<input type="submit" name="continue" id="continue" value="START" onClick="StartClock()" />
<input type="submit" name="continue" id="continue" value="STOP" onClick="StopClock()" /> </td>
</tr>
</table>