How could I change window’s location without reloading and # hack?

Facebook is using the history api in HTML5. From this blog post you can see how this works. Basically they are making calls like the one below to change the url without reloading the page.

window.history.pushState("object or string", "Title", "/new-url");

Here is the HTML5 working draft spec about it: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-location-interface

Sadly, IE9 does not support this api. New versions of Chrome and FF have full support.

Leave a Comment