title: Keeping a timer consistent after multiple refreshes in Javascript
body: <p>I have a countdown timer and when ever I rapidly press f5 the timer freezes.
  im guessing this is because the page reloads before the setInterval.
  i'm looking for a way to reload the page and at the same time keep the timer running whats happening is the page reloads before the setInterval could even finish</p>
  
  <pre><code>&lt;h3 style="color:#000000" align="center"&gt;
           Time Remaining : &lt;span id='timer'&gt;&lt;/span&gt;
           &lt;/h3&gt;
  
  &lt;script type="text/javascript" src="jquery-1.11.3.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
  //define your time in second
      var c = localStorage.getItem("timer");
      if(c == null)c = 3600;
  
      var t;
      timedCount();
  
      function timedCount()
      {
  
          var hours = parseInt( c / 3600 ) % 24;
          var minutes = parseInt( c / 60 ) % 60;
          var seconds = c % 60;
  
          var result = (hours &lt; 10 ? "0" + hours : hours) + ":" + (minutes &lt;        10 ? "0" + minutes : minutes) + ":" + (seconds  &lt; 10 ? "0" + seconds : seconds);
  
  
          $('#timer').html(result);
          if(c == 0 )
          {
              //setConfirmUnload(false);
              //$("#quiz_form").submit();
              window.location="logout.html";
          }
          c = c - 1;
          localStorage.setItem("timer", c);
          t = setTimeout(function()
          {
              timedCount()
          },1000);
  
  
      }
  
  
  &lt;/script&gt;
  </code></pre>