title: Handle browser back button with Javascript / different approach possible by using anchors?
body: <p>I'm currently struggling with a good navigation on a website using Ajax calls and unobstrusive JS. I'm catching the click event on links, load the content, attach it to a div and then return false. This works quite well and also allows Google to crawl the site with speaky URLs.</p>
  
  <p>But I didn't know how to deal with the browser back button. I found this solution to catch the event when the user clicks on the back button:</p>
  
  <p><a href="http://www.bajb.net/2010/02/browser-back-button-detection/" rel="nofollow">http://www.bajb.net/2010/02/browser-back-button-detection/</a></p>
  
  <p>It works quite well. But I also want the back button to work normally when the user found the website via a link and wants to return to the previous page (I don't want to trap anyone).</p>
  
  <p>When I thought about it the best way would be to use anchors. The normal back button supports them and you can go back in history without reloading the page (/#1 &lt;- /#2 &lt;- /#3 etc.)</p>
  
  <p>It would work like this:</p>
  
  <ul>
  <li>Use normal URLs in the link, but catch the click event</li>
  <li>When user clicks, load content and attach it to a DIV</li>
  <li>Change the window.location, using an anchor (e.g. 'domain.com/#products/women-clothing' with window.location="#products/women-clothing";)</li>
  <li>When the window.location changes, get the anchor, read out the path and get the content via ajax, attach it to a DIV</li>
  </ul>
  
  <p>Only the last part isn't really clear for me and I could need help here.</p>
  
  <p>Finaly, my question: Does this make any sense?</p>
  
  <p>Thanks!</p>