title: Auto start file download after form submission
body: <p>I have a web form that users complete online. When they press submit it will start a file download for them.</p>
  
  <p>At the moment, I process the form submission and generate a suitable file for the user and fire it off with suitable headers. eg...</p>
  
  <pre><code>header('Content-type: "application/octet-stream"');
  header('Content-Disposition: attachment; filename="yourfile.txt"');
  header("Content-Transfer-Encoding: binary");
  </code></pre>
  
  <p>However, since this starts a download right away, the original form is left on screen by the browser. </p>
  
  <p>I would really like to go to some "Thank you" screen once the download completes (or before the download starts). I know it is possible, because almost every download site you visit does this (normally to pump you full of adverts before the download starts).</p>
  
  <p>So, How do I show a "Thank You" screen that starts the download after a second?</p>
  
  <p>How would any solution proposed effect the behaviour of the back button, as I don't want the file downloading again without the form being refilled?</p>
  
  <p>I am using PHP on the server and can rely on Javascript (and jQuery) being available on the client.</p>
  
  <p>Thank you.</p>