title: How to retain value of the variable after the page is reloaded?
body: <p>I have function in my code, which suppose to gradually decrease the refreshment of the page from 50 sec to 10 if the button is pressed. Here it is:</p>
  
  <pre><code>  &lt;div id="signin" onclick="pgeReload()"&gt;&lt;/div&gt;
  
     ....
  
   &lt;script type="text/javascript"&gt;
     var count=0;
     function pgeReload(){
  
       if(count &lt;= 4){
         count++;
       }
       var times = count*10000;
       var pospond = 50000-count;
       setTimeout(function(){window.location.reload()}, pospond);
     }
  
   &lt;/script&gt;
  </code></pre>
  
  <p>My problem is that the reload of the page always occurs after 50 seconds because (if I got it correctly) the variable <code>count</code> is always reassigned to 0 when the page reloads. </p>
  
  <p>My Question is can I retain the value of count after it has been incremented even after the refresh of the page?</p>
  
  <p>thank you very much for everyone who can help me with that.</p>
  
  <p>the version with html5. But still, the problem is the initial value. The count is always 0</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var count=0;
  
       function pagereload(){
  
          if(typeof(Storage)!=="undefined")
          {
             count++;
         window.content.localStorage[key]=count;
             var tempTime = parseInt(window.content.localStorage[key])*1000;
             var pospond = 50000-tempTime;
             setTimeout(function(){window.location.reload()}, pospond);
  
          }
          else{
           setTimeout(function(){window.location.reload()}, 30000);
           }
     &lt;/script&gt;
  </code></pre>