Ian,  

Try IRT.org, there's a script there that does exactly what you want

http://developer.irt.org/script/1563.htm

While the example only uses mouse movement, you can also add in onClick()
and onKeyPress() on the onLoad statement and trigger the same resettimer
function as appropriate.

Hth,

larry

>From the site:

Q1563 How can I redirect to another page if there is no activity by the user
for a certain amount of time?

<html>

<head>

<script language="_javascript_"><!--
if (document.layers) {
  window.captureEvents(Event.MOUSEMOVE);
}

window.>
var tID = '';

function resetTimer(e) {
  alert('here');
  clearTimeout(tID); // reset the timer
  tID = setTimeout('executeTimer()',10000);
}

function executeTimer() {
  location.href = '';
}
//--></script>

</head>

<body = setTimeout('executeTimer()',10000)"
> ...
</body>

</html>

> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 02, 2004 12:03 PM
> To: CF-Community
> Subject: Bouncing this idea off my fellow developers.
>
>
> I have a requirement where a page should automatically log
> out after a period of inactivity say five minutes.  So I
> create _javascript_ functions that start a timer and log out
> the page at the end of the set period of time.  I then start
> the timer off and running in the body tag's onload property.
>
> I think that all is pretty straight forward.  But, in this
> scenario the timed event will fire unless the page is
> reloaded, correct?  So, if this is a large page where the
> user may be scrolling and clicking on various elements of the
> page, but not reloading the page the timer will continue to
> run, will it not?  
>
> Is there anyway to distinguish between true inactivity (no
> mouse movement/clicking and/or keyboard inputs) versus time
> between page loads?
>
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> "C code. C code run. Run code run. Please!"
>      - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended
> recipient, please contact the sender and delete any copies of
> this message.
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to