|
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.