title: Downloading a file (or handling an HTTP error) on click
body: <p>I have a button on my page that, when clicked, will try to go out and download a file from a given URL on a <em>different</em> domain than my page's domain.  Sometimes, that download URL will return an HTTP 429 response with an error message as content.  I am trying to be able to handle both cases (successful download vs error).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var w = window.open(url);
  window.focus();
  w.onload = function() {
    console.log(w.document.body.innerHTML);
  };
  </code></pre>
  
  <p>The above code is run on a button click.  What I'm seeing is that the <code>w.onload</code> function is never getting triggered.  What is wrong with using this as a method of downloading a file?</p>