Reputation: 295
In my project I have a requirement where in I want to alert an user with a popup whenever the inactive time is about to hit the session timeout time(For ex:5 mins in advance of session expiry), so that the user can click on continue button and programmatically extend the server session.
What's the best approach to do this?
Upvotes: 0
Views: 3135
Reputation: 448
see the jquery method - http://pure-essence.net/2010/02/14/jquery-session-timeout-countdown/
Upvotes: 0
Reputation: 3558
You can do it with javascript and coldfusion.
<!--- Minutes into MS --->
<cfset sessionTimeout = 2>
<html>
<head>
<title>Timeout Example</title>
<script>
<cfoutput>
var #toScript((sessionTimeout-1)*60*1000,"sTimeout")#
</cfoutput>
setTimeout('sessionWarning()', sTimeout);
function sessionWarning() {
alert('Hey bonehead, your session is going to time out unless you do something!');
}
</script>
</head>
<body>
</body>
</html>
Taken from http://www.webpronews.com/warn-a-user-about-a-session-timeout-with-javascript-2007-01
Upvotes: 1