Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var IDLE_TIMEOUT = 60; var _idleSecondsTimer = null; var _idleSecondsCounter = 0; document.onclick = function() { _idleSecondsCounter = 0; }; document.onmousemove = function() { _idleSecondsCounter = 0; }; document.onkeypress = function() { _idleSecondsCounter = 0; }; _idleSecondsCounter = window.setInterval(CheckIdleTime, 1000); function CheckIdleTime() { _idleSecondsCounter++; var oPanel = document.getElementById("SecondsUntilExpire"); if (oPanel) oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + ""; if (_idleSecondsCounter >= IDLE_TIMEOUT) {
- window.clearInterval(_idleSecondsCounter);
- alert("Time expired!");
- document.location.href = "logout.html";
- }
- }
- </script>You will be auto logged out in <span id="SecondsUntilExpire"></span> seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement