Moving back to a pushState entry that used ajax Moving back to a pushState entry that used ajax ajax ajax

Moving back to a pushState entry that used ajax


It seems that some browsers often confuse the partial loaded via ajax and the entire page, decorated with its layout. That's because they both have the same URL.So when the user click on the back button, the browser won't load the URL and will just display the partial it has previously downloaded via ajax.

To avoid this and maintain two separate internal caches (one for the partial page and one for the entire page), you should add a GET parameter in the URL when calling via ajax. Like this in your code:

popstate = function(url){  $('#content').load(url+'?_ajax=1');}

Hope this helps.