title: Detecting an iframe's onload in Chrome when downloading files
body: <p>I'm using a hidden iframe in an HTML page for downloading purposes. And I would like to know when it's done. I've searched the Internet a lot and everyone says that I should use iframe's <code>onload</code> event handler but it's not working for me in Chrome!</p>
  
  <p>I'm not sure where but I read somewhere that it's because I'm downloading files with my iframe instead of HTML documents. And I must admit that it's specific to Chrome and it works fine in FireFox.</p>
  
  <p>I've also tested <code>readstate</code> and <code>onreadystatechange</code> without success.</p>
  
  <p>I've created a fiddle to demonstrate the problem:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function download(url)
  {
      var iframe = document.createElement("iframe");
      iframe.src = url;
      iframe.onload = function () {
          console.log('Download completed.');
      };
      document.body.appendChild(iframe);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="download('http://www.colorado.edu/conflict/peace/download/peace.zip');"&gt;Download&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>