title: How to force a page to reload if all what was changed in url is hash?
body: <p>I am trying to reload current page with different url hash, but it doesn't work as expected.</p>
  
  <p>(Clarification how I want it to work: Reload the page and then scroll to the new hash.)</p>
  
  <p><strong>Approach #1:</strong></p>
  
  <pre><code>window.location.hash = "#" + newhash;
  </code></pre>
  
  <p>Only scrolls to this anchor without reloading the page.</p>
  
  <p><strong>Approach #2:</strong></p>
  
  <pre><code>window.location.hash = "#" + newhash;
  window.location.reload(true);
  </code></pre>
  
  <p>Kinda works but it first scrolls to the anchor, then reloads the page, then scrolls to the anchor again.</p>
  
  <p><strong>Approach #3:</strong></p>
  
  <pre><code>window.location.href = window.location.pathname + window.location.search + "&amp;random=" + Math.round(Math.random()*100000) + "#" + newhash;
  </code></pre>
  
  <p>Works but I would rather not add random garbage to the url.</p>
  
  <p>Is there a better solution?</p>