title: back button in browser not working properly after using pushState (in Chrome)
body: <p>I am using this type of line in an JS response</p>
  
  <pre><code>if (history &amp;&amp; history.pushState){
       history.pushState(null, null, '&lt;%=j home_path %&gt;');
  }
  </code></pre>
  
  <p>but when I click <code>back</code> in the browser, I see the JS code of the response instead of the previous page.</p>
  
  <p>Is there a way to make the back button work so it would re-request the page of the last url (before <code>home_path</code> as pushStated in?</p>
  
  <p><strong>Update</strong>:</p>
  
  <p>I've found <a href="http://adhockery.blogspot.com/2011/02/javascripts-history-object-pushstate.html" rel="noreferrer">this</a>.. it seems other have the same issue with.. History.js doesn't fix it either</p>
  
  <p>So to confirm some of the comments there.. This happens only in chrome</p>
  
  <p><strong>What I think</strong></p>
  
  <p>I think the root of all this is that the popstate requests the same type of the pushstate document (js response). What needs to be done is on popstate request the html response.. I just don't know how</p>
  
  <p><strong>More updates:</strong></p>
  
  <p>seeing <a href="http://railscasts.com/episodes/246-ajax-history-state" rel="noreferrer">http://railscasts.com/episodes/246-ajax-history-state</a> it mentions to use</p>
  
  <pre><code> $(window).bind("popstate", function() {
        $.getScript(location.href);
      });
  </code></pre>
  
  <p>this solves the issue but according to <a href="https://stackoverflow.com/questions/8930017/understanding-jquery-getscript">understanding jQuery $.getScript()</a>  withtout ajax caching it will add timestamps.. which pollutes the url.. turning it off makes it not work again with the same effect..</p>
  
  <p>Anyone knows how to solves this?</p>
  
  <p><strong>Even more Updates</strong></p>
  
  <p>I tracked the trails of the issue all over the interweb and ended with an <a href="https://code.google.com/p/chromium/issues/detail?id=94369" rel="noreferrer">issue in chrome</a> which points to a rails issue (firefox works fine however) and an <a href="https://github.com/rails/jquery-ujs/issues/318" rel="noreferrer">issue in rails-ujs</a> concerning not including Vary Header in the responses</p>
  
  <p>Example can be found <a href="http://secret-journey-4942.herokuapp.com/movies" rel="noreferrer">here</a></p>