In facebook, if a user opens a chat dialogue window, it will remain there no matter what page he/she visits. For example, one might be on their home news feed page and then navigate to say, their profile or inbox messages and the chat "div" will still be there.
The dialogue window itself is simply just a div with the following attributes:
<div class="fbNubFlyout fbDockChatTabFlyout uiContextualLayerParent" role="complementary" data-ft="{"tn":"+M"}" aria-labelledby="u_0_38" style="max-height: 331px;">
Visually speaking, the whole page will reload while the chat box remains unaffected. How does Facebook do this?