Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Does Github Do pushState Without Hash Tags?

I've been researching the best way to utilize HTML5's history api aka psuhState with a proper fallback for HTML4 browsers.

Github uses the history api for its tree browsing (the following link is just an example, not the library github uses):

https://github.com/browserstate/History.js/

What I can't figure out is how they handle this functionality for HTML4 browsers such as Firefox 3.5?

I've looked at, specifically, history.js (linked above) to handle this sort of thing. But it requires a hash # implementation for HTML4 browsers which I'd like to avoid.

If you visit Github and browse a directory tree using an HTML4 browser, it looks identical to an HTML5 browser (the url state, that is).

If I disable JavaScript in FF3.5, a URL which previously looked like this:

https://github.com/browserstate/history.js/tree/master/tests

now looks like this:

https://github.com/browserstate/history.js/tree/a32e91aa1fe5909a29abb690a37f6c129e98068e/tests

Any thoughts?

like image 812
Yahreen Avatar asked Jul 03 '11 01:07

Yahreen


2 Answers

GitHub uses http://pjax.heroku.com/

For browsers that don't support pushState it simply degrades to normal old boring full-page-load behaviour.

like image 199
Tekkub Avatar answered Sep 22 '22 09:09

Tekkub


Responsive web design from the future is a 96 slide presentation from Kyle Neath, a designer that works at GitHub, that might help you.

pushState. replaceState. Hashbangs. AJAX. PJAX. Beets. Bears. Battlestar Galactica.

Responsive web design is about a lot more than the size of your screen. This talk is about about how GitHub handles links, the url bar, partial page updates, and explains why I think the HTML5 history API is the most important thing to happen to front end development since Firebug.

like image 24
Kevin Hakanson Avatar answered Sep 20 '22 09:09

Kevin Hakanson