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

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

Q1677 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.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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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