Redirecting page based on script outcome
<p>I'm working on the following script. Basically I want to redirect a page to one of two choices, based on whether the browser has allowed a popup. I know that the following won't work because window.location needs to be called as the DOM loads, but I'm wondering if there is something I can use or if I need to rethink my approach </p>

<pre><code>&lt;script type="text/javascript"&gt;
function openwindow(){
    var w = window.open("{INTERACTION}","interaction","resizable=0,width=800,height=600,status=0");
    if(w){window.location = "carry on.html"};
    if(!w){window.location = "blocked.html"};
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;  
&lt;input type="submit"  class="button" onClick="javascript: openwindow()" value="Begin" /&gt;
&lt;/form&gt;
</code></pre>

<p>Thanks in advance
Giles</p>
