Skip to content

Public Configuration Variables

JillElaine edited this page Apr 2, 2015 · 24 revisions

Below is a list of the public configuration variables and their default values. 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 variable 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.

Translate Displayed Text

All user messages may be translated to your desired language via the configuration variables, such as the dialogTitle and dialogText.

Configuration Variable Syntax

Syntax - variableName: variableValue

If more than one variable is listed in the 'document ready' function, you must put a comma at the end of each variableName: variableValue combination except the last combination in the list.

Example - 'Document Ready' Multiple Variables

  $(document).ready(function () {
    $(document).idleTimeout({
      redirectUrl:  '/logout',      // trailing comma
      idleTimeLimit: 1200,          // trailing comma
      sessionKeepAliveTimer: false  // NO trailing comma - last one in the list
    });
  });

String variables, such as user messages, activityEvents and redirectUrl, must be enclosed within single quotation marks.

Timer variables are in seconds, such as idleTimeLimit, and are numbers and should not be enclosed in quotation marks.

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.

idleCheckHeartbeat Variable

This variable controls how many seconds between 'polling' functions, such as checks for user inactivity & logouts. The default is 2 (seconds). A longer time between polls reduces overhead but will make the plugin less 'snappy'.

customCallback Variable

If you want custom function(s) to occur before user logout, user the customCallback variable. Example: customCallback: function () { // define custom js functions here }

activityEvents Variable

The activityEvents variable is a string of event names. The default setting for activityEvents is 'click keypress scroll wheel mousewheel mousemove' and covers most common keyboard and mouse events. Each event name must be separated by one space.

Note that the 'mousemove' event adds some overhead to the function as it fires multiple times on even small mouse movements. And some browsers may detect the 'mousemove' event even when the mouse has not moved.

You can learn more about events at Mozilla's Event Reference and whether a browser correctly detects events (or not) at Quirksmode.

Public Configuration Variables & Their Default Values

  • redirectUrl: '/logout' - String or Boolean false - redirect to this url on logout. Set to "redirectUrl: false" to disable redirect
  • idleTimeLimit: 1200 - Number - 'No activity' time limit in seconds. 1200 = 20 Minutes
  • idleCheckHeartbeat: 2 - Number - Frequency to check for idle timeouts in seconds
  • customCallback: false - Boolean false or JS Code - optional custom callback to perform before logout
  • activityEvents: 'click keypress scroll wheel mousewheel mousemove' - String - separate each event with a space
  • enableDialog: true - Boolean - set to false for logout without warning dialog
  • dialogDisplayLimit: 180 - Number - Time to display the warning dialog before logout in seconds. 180 = 3 Minutes
  • dialogTitle: 'Session Expiration Warning' - String - also displays on browser title bar
  • dialogText: 'Because you have been inactive, your session is about to expire.' - String
  • dialogTimeRemaining: 'Time remaining' - String
  • dialogStayLoggedInButton: 'Stay Logged In' - String
  • dialogLogOutNowButton: 'Log Out Now' - String
  • 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' - String - error message if https://github.com/marcuswestin/store.js not enabled
  • sessionKeepAliveTimer: 600 - Number or Boolean false - ping the server at this interval in seconds. 600 = 10 Minutes. Set to false to disable pings
  • sessionKeepAliveUrl: window.location.href - Code, String or Boolean false - set URL to ping - does not apply if sessionKeepAliveTimer: false
Clone this wiki locally