3 Replies Latest reply on Mar 24, 2014 4:09 AM by hemanthR

    Idle time to reload page

    Zoze Level 2

      Hi everyone,

       

      Can you help me how to write the code right .

       

      I want when on the site have idle time without move or touch to reload the page, in order to start from the beginning.

       

      At Stage -> CreationComplete I have:

       

      idleTime = 0;

      $(document).ready(function () {

          //Increment the idle time counter every minute.

          var idleInterval = setInterval(timerIncrement, 60000);

       

       

          //Zero the idle timer on mouse movement.

          $(this).mousemove(function (e) {

              idleTime = 0;

          });

          $(this).keypress(function (e) {

              idleTime = 0;

          });

      });

       

       

      function timerIncrement() {

          idleTime = idleTime + 1;

          if (idleTime > 1) {

              window.location.reload();

          }

      }

       

      when I tested local it worked, but online it doesn't.

       

      What is missing?

       

       

      Thanks in advanced.