title: Why does window.location.reload need setTimeout to work in firefox
body: <p>With these following codes it works as expected, but with around about 100 ms delay. </p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>function refresh(){
   setTimeout(function(){window.location.reload();},0);
  }
  </code></pre>
  
  <p><strong>index.htlm</strong></p>
  
  <pre><code>&lt;body onresize="refresh()"&gt;
   &lt;!-- dispay graph --&gt;
  &lt;body&gt;
  </code></pre>
  
  <p>Each time when the window's size is being readjusted by user, the graph will change accordingly. Tested on multiple browsers, window.location.reload() is sufficient, but for firefox it needs to be wrapped around by setTimeout. </p>
  
  <p>Read <a href="https://stackoverflow.com/questions/19019518/why-does-window-location-reload-need-to-be-wrapped-in-a-function">this link</a> and <a href="https://stackoverflow.com/questions/11720141/set-onclick-event-using-script/11720212#11720212">this</a>, but still I don't understand why. Haven't I wrapped <code>window.location.reload</code> inside <code>refresh</code> function?</p>
  
  <p>Also about the problem with pointing <code>window.location.reload</code> to the right <code>this</code>, wouldn't method function be enough to assign correct <code>this</code> to the window so it shouldn't need to be wrapped by other function?</p>