Close window, after redirect
<p>Here's my scenario:</p>

<p>I'm opening a window from a javascript file, and setting an interval to check whether that window has been closed or not. (this acts as a callback function of sorts).</p>

<p>The problem is, the window I'm opening is to a page that contains a redirect. So I somehow need a way to have the window close itself after the redirect has taken place (so the callback can be triggered).</p>

<p>Script that opens the window:</p>

<pre><code>oauthWindow   = window.open("login/index.php", "Login", options.windowOptions);
oauthInterval = window.setInterval(function() {
    if (oauthWindow.closed) {
        window.clearInterval(oauthInterval);
        options.callback();
    }
}, 1000);
</code></pre>

<p>The page that's being opened will redirect itself:</p>

<pre><code> $url = $oauth-&gt;getAuthorizeURL($request['oauth_token']);
 header("Location: " . $url);
</code></pre>

<p>I need a way for the window to close itself after that redirect has occurred. (window.close());</p>

<p>Any ideas?</p>

<p>Thanks.</p>
