Skip to content

Public Configuration Variables

JillElaine edited this page Mar 25, 2015 · 24 revisions

Below is a list of the default public configuration variables. If you want to modify the default values of these variables, you may include any or all of these variables in your 'document ready' function when you call the jquery-idleTimeout script.

Note that you must include and set the redirectUrl to your site's logout or redirect page in the 'document ready' function. If you receive a '404 Page Not Found' at timeout, it is likely because this variable was not correctly configured.

All user messages may be translated to your desired language via the variables, such as the 'warning dialog' text.

'Timer' variables, such as idleTimeLimit, are in seconds.

Please note that all variables are case-sensitive and must be spelled correctly. If you have problems, please check for typos, spelling errors and missing commas

//##############################
//## Public Configuration Variables
//##############################
var defaults = {
  idleTimeLimit: 1200, // 'No activity' time limit in seconds. 1200 = 20 Minutes
  redirectUrl: '/logout', // redirect to this url on timeout logout. Set to "redirectUrl: false" to disable     redirect
  // optional custom callback to perform before logout
  customCallback: false, // set to false for no customCallback
  // customCallback: function () { // define optional custom js function
  // perform custom action before logout
  // },

  // configure which activity events to detect
  // http://www.quirksmode.org/dom/events/
  // https://developer.mozilla.org/en-US/docs/Web/Reference/Events
  activityEvents: 'click keypress scroll wheel mousewheel mousemove', // separate each event with a space
  
  // warning dialog box configuration
  enableDialog: true, // set to false for logout without warning dialog
  dialogDisplayLimit: 180, // time to display the warning dialog before logout (and optional callback) in seconds. 180 = 3 Minutes
  dialogTitle: 'Session Expiration Warning', // also displays on browser title bar
  dialogText: 'Because you have been inactive, your session is about to expire.',
  dialogTimeRemaining: 'Time remaining',
  dialogStayLoggedInButton: 'Stay Logged In',
  dialogLogOutNowButton: 'Log Out Now',
  
  // error message
  errorAlertMessage: 'Please disable "Private Mode", or upgrade to a modern browser. Or perhaps a dependent file missing. Please see: https://github.com/marcuswestin/store.js',
  
  // server-side session keep-alive timer
  sessionKeepAliveTimer: 600, // Ping the server at this interval in seconds. 600 = 10 Minutes
  // sessionKeepAliveTimer: false, // Set to false to disable pings
  sessionKeepAliveUrl: window.location.href // set URL to ping - does not apply if sessionKeepAliveTimer: false
}
Clone this wiki locally