Session Timeout Alert Plugin With jQuery userTimeout - Download Session Timeout Alert Plugin With jQuery - userTimeout

Download Session Timeout Alert Plugin With jQuery – userTimeout

Posted on

This time I will share jQuery Plugin and tutorial about Session Timeout Alert Plugin With jQuery – userTimeout, hope it will help you in programming stack.

Session Timeout Alert Plugin With jQuery userTimeout - Download Session Timeout Alert Plugin With jQuery - userTimeout

File Size: 123 KB
Views Total: 30906
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Yet another jQuery session timeout and keep-alive control that checks the user activities and shows an alert modal dialog asking your users if they want to stay connected or to log off after a specified idle time. If log off is clicked, the webpage is redirected to a logout URL you specify.

How to use it:

1. Include jQuery library and the jQuery userTimeout plugin on the webpage.

1 <script src="//code.jquery.com/jquery-1.12.1.min.js"></script>
2 <script src="dist/jquery.userTimeout.js"></script>

2. Include jQuery UI or Bootstrap framework on the webpage. In this case, we use Bootstrap’s modal component for the session timeout alert dialog.

1 <link rel="stylesheet" href="bootstrap.min.css">
2 <script src="bootstrap.min.js"></script>

3. Initialize the plugin as follows. The plugin will displays a Bootstrap based session timeout modal after 3000ms (3 seconds).

1 $(document).userTimeout({
2   session: 3000
3 });

4. Customize the plugin. Here’re default plugin settings which can be passed as an object during init.

01 $(document).userTimeout({
02  
03   // ULR to redirect to, to log user out
04   logouturl: null,             
05  
06   // URL Referer - false, auto or a passed URL    
07   referer: false,           
08  
09   // Name of the passed referal in the URL
10   refererName: 'refer',       
11  
12   // Toggle for notification of session ending
13   notify: true,                     
14  
15   // Toggle for enabling the countdown timer
16   timer: true,            
17  
18   // 10 Minutes in Milliseconds, then notification of logout
19   session: 600000,                  
20  
21   // 5 Minutes in Milliseconds, then logout
22   force: 300000,      
23  
24   // Model Dialog selector (auto, bootstrap, jqueryui)             
25   ui: 'auto',                       
26  
27   // Shows alerts
28   debug: false,           
29  
30   // <a href="https://www.jqueryscript.net/tags.php?/Modal/">Modal</a> Title
31   modalTitle: 'Session Timeout',    
32  
33   // Modal Body
34   modalBody: 'You're being timed out due to inactivity. Please choose to stay signed in or to logoff. Otherwise, you will logged off automatically.',
35  
36   // Modal log off button text
37   modalLogOffBtn: 'Log Off'
38  
39   // Modal stay logged in button text       
40   modalStayLoggedBtn: 'Stay Logged In' 
41      
42 });

Change log:

v0.3.0 (2016-05-14)

  • Cleaned up some of the code
  • Fixed a few minor bugs
  • Added comments to the functions
  • Added support for console errors if debugging is off
  • Included focus as a document event

This awesome jQuery plugin is developed by lleblanc42. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net