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

1

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.

Holle answered 8/6, 2012 at 2:6 Comment(3)
Is it possible that they are storing that box's state in cookie and check this stage on every page?Spiracle
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)Holle
„the Network->XHR in Firebug or Chrome displays nothing in the XHR.” – in my firebug, it sure does.Dulci
O
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).

Otisotitis answered 8/6, 2012 at 17:0 Comment(1)
They use long-polling in everything not only Chat, seems that ever the navigation sometimes goes through the Channel connection (the long polling one).Holle

© 2022 - 2024 — McMap. All rights reserved.