----- Original Message ----- From: "Stephen Hait" <[EMAIL PROTECTED]> Does anyone attempt to warn a user that their session will shortly expire? Could javascript with a timer allow popping up a window, say, when the session will expire in 2 minutes? Are there any better approaches? ----------------------------
You've *just* missed a thread about this. I've just put together a system that works pretty nicely. It's built to try and solve the problem with forms, i.e. a user spends more than 20 minutes on a form - through there being loads of stuff to enter or getting distracted by something else - and submits it and loses everything cos they've timed out. - When you login, the site goes into a frameset. I hate frames normally, but they work for this well. If your site is like mine, a private CMS, all the frames problems (search engines can't index them, users can't bookmark or email links, etc.) become advantages. - The top frame is thin, contains JS countdown, the bottom frame is the main site. - The counter starts off in a very innocuous colour. At 2 minutes, it changes to a noticeable colour. At 30 seconds, it gets even brighter and starts flashing. All this can be tweaked to taste of course. - When it reaches 0, it pops up a JS alert warning to tell the user to copy and paste anything they might lose into Notepad cos they'll lose it otherwise. A JS alert means they *have* to acknowledge this and click OK - popup windows and such like could be missed or ignored. When they click OK, they get redirected back to login. - Of course, this is all pretty annoying if a user can't complete a form in less than the session timeout, so there's a RESET link or button next to the session timer that reloads just the timer frame, refreshing the session without losing the main site window contents. Someone else suggested popping up a window that made a 'dummy' request to refresh the session, then the window closes itself onload. This could be done if you don't want to use the frames solution, but personally I think the frames solution is more elegant, and for the site I'm doing, I think frames work very well. As I said, most of the disadvantages are actually advantages in a private site. - Oh yeah, you need a bit of JS included with every page request while you're logged in that reloads the session timer frame to start the counter again. It might also be nice to have some control to hide/show the timer so people could get rid of it if they want to just use it where they want. I'd be happy to share some of the JS I've put together if you want. cheers, - Gyrus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.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