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

Q1677 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 | Link | Q1677 [ previous next ]

Try:

<html>

<head>

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

window.onMouseDown = myFunction;
var tID = '';

function myFunction(e) {
   clearTimeout(tID); // reset the timer
   tID = setTimeout("window.location='index.html'",180000); // leave the page in 3 minutes
}
//--></script>

</head>

<body onLoad="tID = setTimeout('window.location=\'index.html\',180000)">
...
</body>

</html>

©2018 Martin Webb