I've implemented a JS based timer into our intranet.  You shouldn't need
frames either.  I define the variable "session.StartTime" to whatever my
Application timeout is.  So the code below will fire a dialog box 2
minutes before a timeout.  It works for me, although some users have
told me they never see it.  Try it out and let me know...

<cfif isDefined("session.StartTime")>
<script language="JavaScript"><!--
//-- Variable below defines how many seconds to wait.
var howManySeconds =
<cfoutput>#Replace(NumberFormat((session.StartTime-2) *
60),',','')#</cfoutput>

//--This is the function that pauses, then calls our function below. 
function pause() {
   myTimer=setTimeout("whatToDo()",howManySeconds*1000)
}

//-- Let's notify the user their session is about to time-out.
function whatToDo() {
   alert ("Your session is about to time-out.  Please save anything you
may be working on.")
}
//-->
</script>
</cfif>

> -----Original Message-----
> From: Gyrus [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, June 03, 2002 1:59 PM
> To: CF-Talk
> Subject: Re: How to Handle timed out sessions?
> 
> 
> ----- Original Message -----
> From: "Chakka, Sudheer" <[EMAIL PROTECTED]>
> How to handle the timed user's sessions without loosing the 
> data the user has entered??
> ----------------------------
> 
> One approach I'm probably going to try out in a site I'm 
> currently building is to have a 'session timer'. The idea 
> runs like this at the
> moment:
> 
> - Build the site using two frames, a thin horizontal one 
> across the top or bottom, and the rest is the site itself.
> - In the thin frame, have a JS counter counting the time down 
> from the current session timeout value (scripts like this 
> should be 2-a-penny on the web, if not piss easy to write).
> - Have a button in there that refreshes just that frame, 
> resetting the counter and of course resetting the session 
> with a request to the server (but without affecting the main 
> site frame).
> - Now say the user's been typing away without looking at the 
> timer. Maybe set it to flash on and off when it gets to the 
> last 20 seconds or so? Resurrect the BLINK tag? ;-)
> - Anyway, if the counter reaches 0, either they've ignored 
> the countdown or they've gone to do something else. The 
> counter reaching zero could bring a JS alert that tells the 
> user to make sure they've copy/pasted stuff in the current 
> form outside their browser, cos the session's timed out and 
> next time they click on anything they'll be redirected to the 
> login page and lose all their stuff. A JS alert should ensure 
> they read the warning before doing anything else.
> 
> Seems like it should work nicely, but as I've said, I've not 
> got round to implementing it yet. I usually avoid frames like 
> the plague, but this will be for a CMS that's private anyway, 
> so the bookmarking problem doesn't apply. Plus, can't think 
> of another solution.
> 
> Let me know if you try it!
> 
> - Gyrus
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> - [EMAIL PROTECTED]
> work: http://www.tengai.co.uk
> play: http://www.norlonto.net
> - PGP key available
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to