Implement the browser history handling, with HTML5 pushState