title: rails: emulate "Save page as" behaviour
body: <p>for a rails project I need to provide the user with a downloadable HTML version of a statistics page. I got so far as creating a controller action that will set the header as follows and then render and return my vanilla html page:</p>
  
  <pre><code>headers["Content-Type"] ||= 'application/x-unknown'
  headers["Content-Disposition"] = "attachment; filename=\"#{filename}\"" 
  </code></pre>
  
  <p>This will make the browser pop open the download dialog instead of rendering the html right away, which is desired. However, this only gives me the blank HTML without any images or css embedded.</p>
  
  <p>What I'd like to do is essentially the same thing that the browser does when you click on the "Save Page as" menu item (probably even zip images, css and html file up in a zip file and return that).</p>
  
  <p>What's the right way to do this? Is there a way to invoke the browser "Save page as" dialog with a header setting?</p>
  
  <p>Regards,</p>
  
  <p>Sebastian</p>