Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Timeout | Q1563 [ previous next ]

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?'

©2018 Martin Webb