Search code examples
htmlperformancebrowserbrowser-history

How do these new websites load pages almost AJAX-like but update the history?


I admit. I haven't done much research on my own (damn me).

There are a few websites (Gizmodo, Hulu) that have rapid reload times and appear to be AJAXian, but update the history. It functions like a full page load, but doesn't have the full page load behavior. For reference: I'm using Chrome, but Safari does it too.

I've looked for pre-render tags and that doesn't seem to do the trick. Is this really just a case of super-fast loading? Does everyone with a lean stack benefit? I don't see it, so perhaps I'm doing something wrong.

Is this a browser enhancement? If so, what can I do to take advantage?

I WILL figure this out eventually. I was just going to hit of SO first before delving into the dungeons of tcpdump and AJAX reverse-engineering.


Solution

  • You're looking for pushState from the "HTML5" set of APIs. The pages are using ajax to pull in only the parts that need to change and pushing changes to the URL using pushState - then they listen for popstate events and update the page as you use the browser's back and forward buttons.

    See also: