7

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.

Shehabic
  • 6,347
  • 6
  • 46
  • 91
  • Is it possible that they are storing that box's state in cookie and check this stage on every page? – Jonas T Jun 08 '12 at 02:10
  • no the Chat Window doesn't reload doesn't even disappear for 1 milli-second while the whole page reloads as if it was another window just above the page. (But it's not) – Shehabic Jun 08 '12 at 02:16
  • „the Network->XHR in Firebug or Chrome displays nothing in the XHR.” – in my firebug, it sure does. – CBroe Jun 08 '12 at 08:44

1 Answers1

1

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).

Wes Johnson
  • 2,943
  • 20
  • 31
  • They use long-polling in everything not only Chat, seems that ever the navigation sometimes goes through the Channel connection (the long polling one). – Shehabic Jun 10 '12 at 22:24