title: Can use pushState
body: <p>Does anyone know of a library that determines if pushState can be used?</p>
  
  <p>I was using this:</p>
  
  <pre><code>if(window.history.pushState){
      window.history.pushState(null, document.title, path);
  }else{
      location.pathname = path;
  }
  </code></pre>
  
  <p>But I just found out that there is a bug in Safari 5.0.2 that causes it not to work even though the above test passes: <a href="http://support.github.com/discussions/site/2263-line-links-broken">http://support.github.com/discussions/site/2263-line-links-broken</a>.</p>
  
  <p>I'm thinking there might be other gotchas and someone has probably already found them and wrapped em up but I haven't found anything yet.</p>
  
  <p><strong>Edit:</strong>
  @Crescent Fresh</p>
  
  <p>From what I've seen it seems like pushState pushes onto the history stack and changes the url but doesn't update location.pathname. In my code I'm using setInterval to check if the path has updated.</p>
  
  <pre><code>var cachedPathname = location.pathname;
  if(window.history.pushState){
      cachedPathname = location.pathname;
      setInterval(function(){
          if(cachedPathname !== location.pathname){
              cachedPathname = location.pathname;
              //do stuff
          }
      }, 100);
  }
  </code></pre>
  
  <p>In Safari 5.0.2 the location.pathname doesn't change when pushState changes the url. This works in other browsers and versions of Safari.</p>