0

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
ak123
  • 285
  • 2
  • 5
  • 15

2 Answers2

1

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

WhoaItsAFactorial
  • 3,538
  • 4
  • 28
  • 45
0

see the jquery method - http://pure-essence.net/2010/02/14/jquery-session-timeout-countdown/

Tommy Ng
  • 438
  • 1
  • 4
  • 10