How do I know when download from a URL is completed?
<p>On my project I use something like the following function to redirect users in order to download a file</p>

<pre><code>function promptDownload(file){
      location.href = "http://example.com/downloads/"+file;
}
</code></pre>

<p>As we all know, when I call this function, browser only prompts a download dialog and does not interrupt my application flow. What I would like to do is to determine when this download completed or cancelled.</p>

<p>There should be something like <code>onLoad</code>, <code>onFinishedLoading</code>, <code>onConnectionEnd</code> or etc but I couldn't find anything.</p>
