How did Facebook implement the chat sidebar?

I am trying to understand how Facebook implements the sidebar of the chat. It seems to stay there even when I change pages. For example, if I select some text inside the sidebar, and then go to another Facebook page, the text will remain selected. It is as if it were a separate frame, but when I look at the code, it is not.

+7
source share
3 answers

There is a container DOM element called "fb_content", its contents are replaced by straightforward AJAX or, more technically, XMLHttpRequest . (Although, for example, when you enter the application, the entire page is refreshed.) To update the address bar, they use the JavaScript History API .

+3
source

All requests are made through AJAX calls. If necessary, only the "content" container is replaced.

In fact, you do not go to another page. The div "content" is just updated.

+4
source

In addition to what Zeno and lericson said (fb_content is updated via ajax), the address bar is also updated when the history is saved (if you press back / forward).

0
source

All Articles