J. Doe J. Doe - 4 months ago 8x
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.


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