Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Facebook's Chat Window Remains open and in the same place When you navigate through pages

How does Facebook's Chat Window Remains open and in the same place When you navigate through pages

Please before you answer:

1-I'm aware of Ajax very well and the current implementation in Facebook is not normal Ajax like it used to be in the past.

2-The URL of the page changes completely not the Hash part, and the whole page reloads but not the Chat window or panel.

I Found that the URL changes through this JS Part:

history.pushState({},"New Title Goes Here","http://facebook.com/Something");

But what about the data itself how doesn't it come ? the Network->XHR in Firebug or Chrome displays nothing in the XHR. so I guess it's not Ajax.

like image 683
Shehabic Avatar asked Jun 08 '12 02:06

Shehabic


1 Answers

Looks like plenty of ajax to me.

enter image description here

They're selective in when they reload the chat window. Ie: if you go to account settings, and other less-traveled pages.

For the chat window loading itself, I'm fairly certain they use long-polling (comet).

like image 63
Wes Johnson Avatar answered Oct 29 '22 13:10

Wes Johnson