Let me see if I can be more descriptive in the issue.
I am having trouble with setTimeout working on a second call to the
setTimeout function from a second page which is an html page.
Here is the scenario.
I have an asp.net web page and through the onload event it calls a
javascript function which calls
setTimeout which will be used to indicate a session is about to expire.
The Session timer warning of session expiration will start a second
javascript function -- "Warn()".
The Warn function displays an html page -- “delayed-popup-window.html’ --
using window.open and start another timer which upon countdown will cause the
html page to close after a short period of time. The
“delayed-popup-window.html’ page has a button and when pressed it indicates
that session should be active and will close the “delayed-popup-window.html’
page but attempts to start the first timer again to once again warn of a
session timeout. This is when the first timer fails to work.
From the “delayed-popup-window.html’ page – when I close the close the html
page just after I call the setTimeout, the setTimeout function seems to not
work?
(This is what appears to be happening. Is there any work around?)
Or can someone tell me how I can somehow get the first asp.net page to start
the timer again. In other words, have the first asp.net page call the
setTimeout function again but somehow this event or capability has to be
instigated from the “delayed-popup-window.html’ page that was started through
the setTimeout function?
I have considered using setInterval instead of setTimeout. But if I do this
then the html page must be able to access the return value of the setInterval
call so that the html can call clearInterval. So if I do this then I need to
pass to the html page the TimerID. How can I do this?
Any insight would be appreciated!!!!
############################################
This is the warn.js file
var timerID;
function Warn()
{
var delayed;
windowprops = "left=350,top=350,width=267,height=103";
delayed = window.open( "/bms/Expiration/delayed-popup-window.html",
"preview", windowprops );
setTimeout("delayed.close();", 30000 );
}
function doWarnPrep()
{
timerID = setTimeout ("Warn();", 1 * 60000 );
}
###################################
This is typical of the first asp.net page
<%@ Register TagPrefix="HDR" TagName="UserHeader" Src=
"/bms/EdgarHeader.ascx" %>
<%@ Register TagPrefix="FTR" TagName="UserFooter" Src=
"/bms/EdgarFooter.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<HTML>
<HEAD>
<title>Default</title>
<script language="javascript" src="JScripts/Default.js"
type="text/javascript"></script>
<script language="javascript" src="/bms/scripts/date.js"
type="text/javascript"></script>
<meta content="Microsoft Visual Studio 7.0"
name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta
content="
http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="/bms/css/main.css" type="text/css"
rel="stylesheet">
<LINK href="/bms/css/secondary.css" type="text/css"
rel="stylesheet">
<LINK href="/bms/css/forms.css" type="text/css"
rel="stylesheet">
<script language="JavaScript"
src="/bms/javascript/scripts.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript"
src="/bms/Expiration/javascripts/Warn.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.onload=startList;
//--><!]]>
</script>
<script language="javascript"
src="../scripts/edgar.js"></script>
</HEAD>
<body MS_POSITIONING="GridLayout" onload="javascript:doWarnPrep()">
And so on…
##########################
This is the delayed-popup-window.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio
..NET 7.1">
<meta name="ProgId" content="VisualStudio.HTML">
<meta name="Originator" content="Microsoft Visual Studio
..NET 7.1">
<script language="javascript" type="text/javascript"
src="/bms/Expiration/javascripts/Warn.js"></script>
<script language="javascript">
function RefreshButton()
{
timerID = setTimeout ("Warn();", 1 *
60000 ); //ISSUE IS HERE********************
window.close();
}
</script>
</head>
<body>
<form>
<table bgcolor="#0" BORDER="0"
CELLSPACING="1" CELLPADDING="5" ID="Table1">
<tr>
<td width="192"
bgcolor="#99cc33" valign="top" rowspan="2" class="bodytext">
<br><STRONG>Due
to Inactivity. Session will expire in 2 minutes</STRONG><br>
</td>
</tr>
<tr>
<td bgColor="#99cc33">
<input
type="button" value="Press to Stay Connected"
onclick="javascript:RefreshButton();" runat="server">
</td>
</tr>
</table>
</form>
</body>
</html>
--
Ed Reyes