J. Doe J. Doe - 1 year ago 138
jQuery Question

Show Logout Modal after 1800 seconds

I have installed a PHP script which logs the user out when 1800 seconds without activity have passed. So when you click a link when 1800 seconds have passed, you will be logged out.

I want this to be real time. So if 1800 seconds have passed, show the user a bootstrap modal. This needs jQuery and that is not a problem at all.


if(timehaspassed -> 1800 sec) {

thanks in advance.

Answer Source

use setTimeout function of javascript. This will gives alert after 1 second. you can change the time whatever you want.

  alert("show logout model"); // call your function show(); here
}, 1000);

Reference : http://www.w3schools.com/jsref/met_win_settimeout.asp

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download