Sunday 15 May 2011

Javascript Inactivity timer logic -


I am trying to implement an inactivity timer using javascript

Confirmation "Inactive for 2 minutes," Yes Click "to continue pls If the user does not answer 1 minute, the user will be redirected to some page

   

What is wrong with the code given above

I will take a swing On

  var idle_timer = 120000; // Check every 2 minutes var kick_timer = 60000; // kick user after 1 minute var redirect = function () {window.location = "http://google.com"; }; Var idler = function () {// kick timer var start kick_timer = setTimeout (redirect, kick_timer); // Prompt the user is OK to click on (Confirm ("You get boot in 60 seconds. Do you want to boot?")) {ClearTimeout (kick_timer); } Else {redirect (); }}; // Schedule idler set interval (idler, idol_timer);    

No comments:

Post a Comment