title: How to implement a periodical page refresh with a failover
body: <p>I am trying improve the fault tolerance in a JSP-page that is updated on a periodical basis. A timeout is used to keep track of when it is time to submit the page.</p>
  
  <p>Problem is that the communication regularly fails which leaves us with a broken/missing page that won't refresh when the communication is up and running again.</p>
  
  <p>The code below is the current implementation.  </p>
  
  <pre><code>function startTimer(buttonid) {
      var startstring = 'myTimer("' + buttonid + '")';
      window.setTimeout(startstring,15000);
  }
  
  function myTimer(buttonid) {
     window.document.forms[0].submit();   
  }
  </code></pre>
  
  <p>startTimer() is called in the onload event of the page.</p>
  
  <pre><code>&lt;body onload="startTimer('blurp');
  </code></pre>
  
  <p>Best solution is a page that gracefully degrades when the communication is down. In that case it emits an error message and tries to refresh after a set period again.</p>
  
  <p>I was looking at PeriodicalUpdater in Prototype as a way to solve this problem. </p>