Javascript: Close a window when an iframe is on a certain page?
<p>I have a system on my website that logs users in. Once the user is logged in, I need the popup window that it takes place in to close and the parent window to refresh. This system could go through different pages depending on if the user has even been there before, etc., but the ending page will always be the same.</p>

<p>I tried writing my own JavaScript for this, but since I do hardly any work with it, I can't get it to work quite right. Here is what I have, which I believe to be pretty close to what I want the end result to be:</p>

<pre><code>&lt;script type="text/javascript"&gt;
var iframe = document.getElementById("IFRAME ID").contentWindow.location.href;
var url = "ENDING PAGE URL";
function LoadFrame() {
if (iframe == url) {
window.close();
if (window.opener &amp;&amp; !window.opener.closed) {
window.opener.location.reload();
} else {
} 
&lt;/script&gt;
</code></pre>

<p>So I guess that I'm asking what do I need to change/add/fix/get rid of/whatever to make this work?</p>
