title: Redirect parent window on child window close
body: <p>We have two browser windows:</p>
  <ol>
  <li>A parent window where the visitor clicks &quot;start chat&quot; -- <strong>W1</strong></li>
  <li>A chat window which opens up(popup) when user clicks on &quot;start chat&quot;
  which is from a different domain. -- <strong>W2</strong></li>
  </ol>
  <p><strong>Requirement</strong>: When the visitor closes the chat window(W2) after the chat, we need the parent window(W1) to redirect to the &quot;thank you&quot; page.</p>
  <p>Since W1 and W2 are of different domains, we need to redirect W2 to the same domain as on W1 so that we can redirect W1 from the W2 using JavaScript (same origin policy)</p>
  <p><strong>What I tried</strong>: <code>onunload</code> and <code>onbeforeunload</code></p>
  <p><strong>Note</strong>: We do not need to redirect to &quot;thank you&quot; page always( eg: when the chat operator is offline)</p>