idle Activity Timeout and logut redirect for jQuery
Latest commit b71a92f May 23, 2014 @philpalmieri Merge pull request #7 from portal7/patch-1
Update on File
Failed to load latest commit information. Additional options for jquery dialog Feb 19, 2013
index.html initial commit from svn port May 10, 2012
jquery-idleTimeout.js Update on File May 22, 2014


idle Activity Timeout and logut redirect for jQuery


Note: This uses the jQuery UI dialog, and UI themes. I am working on a non UI version – but it may be a while

I have an active demo here – it is running on a 30 second timer for the logout, and if you open firebug you will see the keep alive firing every 10 seconds.

How to use

Run with defaults

$(document).ready(function(){ $(document).idleTimeout(); });

With Optional Overrides

$(document).ready(function(){ $(document).idleTimeout({ inactivity: 30000, noconfirm: 10000, sessionAlive: 10000 }); });

The plugin has a few configuration items so you can customize it for your own needs…

  • inactivity: 1200000 //20 Minute default (how long before showing the notice)
  • sessionAlive: 300000, //5 minutes default how often to hit alive_url, we use for our ajax interfaces where the page doesn’t change very often. This helps to prevent the logout screen of your app appearing in ajax callbacks. If you set this to false it won’t send off.
  • alive_url: ‘/path/to/your/imHere/url’, //send alive ping to this url
  • redirect_url: ‘/js_sandbox/’, //Where to go when log out
  • click_reset: true, //Reset timeout on clicks (for ajax interface) – resets the sessionAlive timer, so we are not hitting up your app with alive_url if we just did an ajax call for another reason.
  • logout_url: ‘/js_sandbox/timedLogout/index.html’ //logout before redirect (url so you can completely destroy the session before redirecting to login screen)
  • dialogTitle: ‘Auto Logout’ //Title for the notice dialog
  • dialogText: ‘You are about to be signed out due to inactivity.’ //Content text for the notice dialog
  • dialogButton: ‘Stay Logged In’ //Button label to stay logged in