title: Javascript detect closing popup loaded with another domain
body: <p>I am opening a popup window and attaching an onbeforeunload event to it like this:</p>
  
  <pre><code>win = window.open("http://www.google.com", "", "width=300px,height=300px");
  win.onbeforeunload = function() {
      //do your stuff here
      alert("Closed");
  };
  </code></pre>
  
  <p>If I leave the URL empty, the new popup opens with "about:blank" as the address but when I close it, I see the alert.</p>
  
  <p>If I open in as you see it (with an external URL), once it's closed, I cannot see the alert anymore. Any idea why this is happening?</p>