callback function for location.href
<p>We have below code</p>

<p><strong>Javascript:</strong></p>

<pre><code>function Download() {
            //Show Loading Spinner
            location.href = "FileDownloadHandler.ashx";              
            //Some Code(Hiding Loading Spinner)
        }
</code></pre>

<p><strong>aspx page:</strong></p>

<pre><code>&lt;input type="button" value="Download" onclick="Download();" /&gt;
</code></pre>

<p>"FileDownloadHandler" will download the file to the user. </p>

<p><strong>Actual Result:</strong>
Code below location.href is executing immediately without completion of handler execution.</p>

<p><strong>Expected Result:</strong>
I want to stop executing "SomeCode" until handler completes the execution. </p>

<p>How can I achieve this?</p>

<p>Thanks in advance.</p>