title: window.opener is useless after a redirect in the popup window (JavaScript)
body: <p>I'm building an app that involves authentication via third-party. To make the process not redirect the actual app I open a new window that then does the authentication and returns to main window after success.</p>
  
  <p>This doesn't, however, go as well as planned. When the popup redirects to third-party and back, <code>window.opener</code> gets <code>null</code>. It's still possible to close the popup by <code>window.close()</code> but I also need to refresh the logged-in-area in the main window, like this:</p>
  
  <pre><code>window.opener.check_auth_status();
  </code></pre>
  
  <p>I really hope there is a way to fix this, e.g. binding a function to popup-close in the main window? Refreshing the whole page would be highly unnecessary.</p>
  
  <p>One way is to <a href="https://stackoverflow.com/questions/140133/how-would-i-raise-an-event-jquery-or-vanilla-javascript-when-a-popup-window-is">set an interval to main window</a> checking if the popup is closed, but this seems so fiddly.</p>