code_junkie

How can I check to make sure a window is being actively used, and if not alert the end user that they are about to be logged out?

Nov 11th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <meta http-equiv="refresh" content="900;url=http://example.com/login"/>
  2.  
  3. <input type="text" onClick="doSomething;">
  4.  
  5. Mozilla way: element.addEventListener('click' ...)
  6. Microsoft way: element.attachEvent('onclick' ...)
  7.  
  8. setTimeout(timeoutWarning, 240000);
  9.  
  10. function timeoutWarning() {
  11. if(confirm('You have been idle for a while. Would you like to remain logged in?'))
  12. window.location.refresh();
  13. }
Add Comment
Please, Sign In to add comment