gillers322
gillers322

Reputation: 249

Javascript - Inactive user log out

I am looking for a really simple piece of javascript code that I can add to an html page that senses when a user has been inactive for 30 minutes, pops up a message for 1 minute and logs the user out of a web application if the user doesn't respond to keep the applcation open.

Thanks

Upvotes: 0

Views: 2275

Answers (1)

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28990

You can try with idleTime

Link : http://paulirish.com/2009/jquery-idletimer-plugin/

Sample :

$.idleTimer(100);
$(document).bind("idle.idleTimer", function()
{
    var reload = confirm("If you refresh your page ?");

    if (reload)
         location.reload(true);
    else
         window.location = "You log Out";

});

Upvotes: 2

Related Questions