title: JavaScript; communication between tabs/windows with same origin
body: <p>I have two windows: window A and window B.</p>
  <ul>
  <li>window A and window B have same domain</li>
  <li>window A and window B doesn't have any parent window.</li>
  </ul>
  <ol>
  <li>Is it possible for window A to get a reference of window B?</li>
  <li>What is the most elegant way to make window A notify something to window B?
  (including new HTML5 specifications)</li>
  </ol>
  <p>Two ways I am aware of doing this:</p>
  <ul>
  <li>messaging by server: where window B regularly asks the server if window A has notified something</li>
  <li>messaging by local data (HTML5): when window A wants to notify something it changes the local data, window B regularly checks the local data for any changes.</li>
  </ul>
  <p>But the two ways are not so elegant.</p>
  <p>For example, it would be nice to get a reference of window B and use window.postMessage() (HTML5)</p>
  <p>The ultimate goal is to make something like Facebook where if you open four Facebook tabs and chat in one tab, the chat is up to date in every Facebook tab, which is neat!</p>