title: HTML5 History: Problems with back button after full page load
body: <p>I build a web app which uses AJAX and the HTML5 history (with a fallback for older browsers, <a href="https://github.com/balupton/History.js/" rel="nofollow">history.js</a>).</p>
  
  <p>Only part of my app is loaded through background javascript (the part which is quite heavy and will be used most of the time). Other pages are reached by regular links and a full page reload will occur when these pages are loaded.</p>
  
  <p>When I navigated the dynamic part a bit (URL changes and fits the content displayed), left it through a regular link and then hit the browsers back button, something weird happens: Only the part which was loaded in the last XHR (in my case a div containing some data) is shown without the layout and css. When I look at the source (in Chromium and FF+Firebug) the DOM only consists of the said div.</p>
  
  <p>I expected that the browser either cached the DOM and other information, so it would be able to rebuild the previous page, or it would reload the last URL (the page would be shown as expected because if it isn't loaded through a XHR it will be rendered within the layout). I tried to set the cache control headers on the response to the XHR, but it didn't help.</p>
  
  <p>I put together a <strong>minimal example</strong>: <a href="http://moserei.de/html5_history/" rel="nofollow">http://moserei.de/html5_history/</a></p>
  
  <p>Thank you for your help!</p>