title: How can I remove the location hash without causing the page to scroll?
body: <p>Is it possible to remove the hash from <code>window.location</code> without causing the page to jump-scroll to the top? I need to be able to modify the hash without causing any jumps.</p>
  
  <p>I have this:</p>
  
  <pre><code>$('&lt;a href="#123"&gt;').text('link').click(function(e) {
    e.preventDefault();
    window.location.hash = this.hash;
  }).appendTo('body');
  
  $('&lt;a href="#"&gt;').text('unlink').click(function(e) {
    e.preventDefault();
    window.location.hash = '';
  }).appendTo('body');
  </code></pre>
  
  <p>See live example here: <a href="http://jsbin.com/asobi" rel="noreferrer">http://jsbin.com/asobi</a></p>
  
  <p>When the user clicks '<strong>link</strong>' the hash tag is modified without any page jumps, so that's working fine.</p>
  
  <p>But when the user clicks '<strong>unlink</strong>' the has tag is removed and the page scroll-jumps to the top. I need to remove the hash without this side-effect.</p>