Javascript unload page condition
<p>I am using the following code to prompt the user that if he left the page he can't come back. Things happened that i want to redirect the page using setTimeout function after a specific time. I want to disable checking for user leaving the page when the automatic redirection starts.</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
        needToConfirm = true;
        window.onbeforeunload = askConfirm;

        function askConfirm(){
            if (needToConfirm){
                return "Please note that you might not be able to come back and watch the movie again.";
                }
            }
    &lt;/script&gt;
</code></pre>
