views:

737

answers:

2

I want to know how Facebook is doing their iframe footer bar. I mean, i know they have an iframe on footer, but i want to know how they are reloading pages without reloading the iframe also, 'cause the iframe always stick there even though the page does reload again. Any ideas/knowledge?

EDITED:

Try clicking on a link which is different section and it changes the url and so far i know, if you try to change the URL, then the page will reload again. Also, try using Facebook on Chrome: you will see it reloads on every new page. It's not AJAX, because the URL wouldn't change if it was AJAX (do little research on URL changing, you will know).

A: 

This is Ajax

powtac
You should use the actual hyperlink feature. In any case, the devs already know about this issue.
Brandon
That's not helpful at all.
Tamás Szelei
+3  A: 

Well, powtac pretty much gave you the answer: Facebook doesn't reload the whole page when you click a link, it requests the new content via XMLHttpRequest and refreshes only those portions of the page that change.

It's pretty slick about this: a naive implementation might not use real links at all, thus preventing you from opening, say, a different Facebook tab in a separate browser tab.

This technique - intercepting link navigation - also allows Facebook to use custom prompts when you try to navigate away without saving, and re-write paths as fragments, allowing it to track the current location in the URL without reloading the page.

FWIW, this question has already been asked and answered - see: How are the facebook chat windows implemented?

Shog9
powtac
try clicking on a link which is different section and it changes the url and so far i know, if you try to change the url, then the page will reload again. also try using facebook on chrome, you will see it reloads on every new page. its not ajax, because url wont change, if it was ajax (do little research on url changing, you will know)
Basit
@basit: see my edit. It only changes the URL *fragment*, which doesn't force the page to reload.
Shog9
@shog9: try changing url http://somedomain.com/subpages page to http://somedoain.com/subpages/page2/ - you will see it will reload and i tried facebook, it changes url and not its fragment (#something)
Basit
Give me a real example: what URL can you click *on Facebook*, that keeps you *on Facebook*, and doesn't just change the URL fragment...
Shog9
i dont know, this might be stupid.. but i think i missed the #fragment code, i feel stupid. sorry to bother you guys, but really thank you alot, i really much appreciate your guys help. also if anyone know how can i do same thing with changing the url, then please let me know, i want to implement it, if possible.again thank you shog9
Basit
You can see the "#" behavior also here: http://jqueryui.com/demos/tabs/ click on the orange arrow on the left. The URL changes and AJAX(!) is reloading the demo area.
powtac