Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Timeout | Q1563 [ previous next ]

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

Try:

<html>

<head>

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

window.onMouseMove = resetTimer;

var tID = '';

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

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

</head>

<body onLoad="tID = setTimeout('executeTimer()',10000)" onMouseMove="resetTimer()">
...
</body>

</html>

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.