We have a requirement wherein we need to display to the users a message before the session timesout, say 5 mins before the timeout, we would like to show a message like "Please save your work, else the data will be lost".
Is something like this doable and if yes can someone pls suggest how.
Thanks in advance
Samir
-
Showing Message before Session TimeOut (4 messages)
- Posted by: Samir Waghu
- Posted on: March 30 2004 03:04 EST
Threaded Messages (4)
- Showing Message before Session TimeOut by Mircea Crisan on March 30 2004 05:42 EST
- Showing Message before Session TimeOut by Samir Waghu on March 30 2004 20:44 EST
- Showing Message before Session TimeOut by Sanjaya Ganesh on March 30 2004 10:11 EST
- Showing Message before Session TimeOut by balaji balakrishnan on March 31 2004 01:35 EST
- Showing Message before Session TimeOut by Samir Waghu on March 30 2004 20:44 EST
-
Showing Message before Session TimeOut[ Go to top ]
- Posted by: Mircea Crisan
- Posted on: March 30 2004 05:42 EST
- in response to Samir Waghu
Hi,
I guess you could use a javscript timer that pops up an alert 5 minutes before the session expires. This timer should be started whenever a page is loaded (<body onload="..." >). Googling for javascript timers I have found this time example: http://www.javascript-page.com/timer.html.
Best regards, Mircea -
Showing Message before Session TimeOut[ Go to top ]
- Posted by: Samir Waghu
- Posted on: March 30 2004 20:44 EST
- in response to Mircea Crisan
Hi Mircea,
Thanks for the reply. I have thought of this option, but the problem is how can we start the counter. The counter should not start when the page is loaded but when the user stops any activity on the page/form. How do we achieve this???
Thanks in advance
Regards,
Samir -
Showing Message before Session TimeOut[ Go to top ]
- Posted by: Sanjaya Ganesh
- Posted on: March 30 2004 22:11 EST
- in response to Samir Waghu
Hi Mircea,Thanks for the reply. I have thought of this option, but the problem is how can we start the counter. The counter should not start when the page is loaded but when the user stops any activity on the page/form. How do we achieve this???Thanks in advanceRegards,Samir
Samir,
You can think of it the other way. Instead of START THE COUNTER WHEN ACTIVITY STOPS, you can TOP-UP THE COUNTER WHEN ACTIVITY HAPPENS.
-Sanjay -
Showing Message before Session TimeOut[ Go to top ]
- Posted by: balaji balakrishnan
- Posted on: March 31 2004 01:35 EST
- in response to Mircea Crisan
Probably this might help you.
Start the timer when the page is loaded. Reset the timer if the user does some action in the page.
document.onmousedown= resetTimer
var timerId;
timerId = window.setTimeout("timeOut()",5000);
function resetTimer() {
window.clearTimeout(timerId);
timerId = window.setTimeout("timeOut()",5000);
}
function timeOut(){
// do something here
alert("Timed out");
}