title: Keeping history of hash/anchor changes in JavaScript
body: <p>I'm currently implementing a JavaScript library that keeps track of the history of changes to the hash part in the address bar. The idea is that you can keep a state in the hash part, and then use the back button to go back to the previous state.</p>
  
  <p>In most of the recent browsers, this is automatic and you only have to poll the <code>location.hash</code> property for changes (In IE8 you don't even have to do that; you simply attach a function to the <code>onhashchange</code> event.)</p>
  
  <p><strong>What I'm wondering is</strong>, what different methods are there to keep track of the history? I've implemented functionality that has been tested to work in Internet Explorer 6/7/8, Firefox and Chrome, but what about other browsers? Here's the ways I currently keep the history:</p>
  
  <p><strong><em>Edit</strong>: See my answer below instead for a walk-through of the various browsers.</em></p>