Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change browser URL and page content without reload and without using fragments

I'm well aware of the technique of using URL fragments to track state on an AJAX powered webpage, but lately I've noticed a lot of sites that are doing something similar but without fragments.

The picture viewer in the latest version of Facebook for example operates this way. The left and right navigation buttons are simple links with no fragments that when clicked change the browsers URL without doing a full page load.

Another example is GitHub's repository browser, each of the files/folders is a simple link that changes the page state and browser URL without reloading or using page fragments.

Can anyone explain, or point me to an explanation of how this works? I've done some searching, but there is so much content on using fragments that I haven't been able to find anything.

like image 459
joshperry Avatar asked Feb 12 '11 17:02

joshperry


2 Answers

I believe this is due to the new History pushState HTML5 feature

like image 94
jerluc Avatar answered Sep 21 '22 14:09

jerluc


They are using new HTML5 History API. I think this is what you want. check the menu items in this page http://tinywall.info/demos/html5-history-api/menu1.php

The tutorial to implement is right here : http://t.co/M4RvnvoQ

like image 24
Arun David Avatar answered Sep 21 '22 14:09

Arun David