How does Facebook Ajax work? 2-3 months ago they were using # but now the whole addressbar is changing.
Asked
Active
Viewed 7,081 times
6
-
1What do you mean by "Facebook Ajax work" ??? It's a bit too general .. – dwarfy Apr 26 '11 at 15:49
-
I mean some facebook pages are not in ajax, so you completely change your adress an go to another page, some content is fetched using ajax, for example when you get to the end of the wall and it loads more content. And some content is updated using "comet" or "long-polling" meaning facebook keeps an open connection with you and send you updates in realtime when necessary ... So what do you mean ? – dwarfy Apr 26 '11 at 15:51
-
What I mean is when I am on my profile and click to profile of my friend. – borayeris Apr 26 '11 at 16:02
2 Answers
10
The first approach used is called "Ajax Crawling" (also refer to this answer).
But I think the new approach you are talking about is just the HTML5 History API. Github is using this approach for their tree browsing, and you can learn more about it here. (I recommend ALL readers to read and watch the video as it's very informative)
EDIT:
Just to point out that Facebook is definitely using the HTML5 History API (direct link from the previous github article).
0
They still use # as far as I can tell (but maybe we are on different versions?). For me, their links are for different pages, but they intercept my onclick and change the click to an Ajax request instead. Maybe this is to make cleaner URLs when copying and/or make it work without JS?

Emil Vikström
- 90,431
- 16
- 141
- 175
-
Maybe. But my version doesn't have # but still header is static and address bar and content is changeable. – borayeris Apr 26 '11 at 15:50