title: javascript - opening hidden iframe for file download on document ready
body: <p>I’m trying to use this trick to open a file download dialog on document ready. The same trick has worked another time for me, but that time the iframe was added after an ajax call. This is the snippet:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function() {
       var url='/my_file_url/';
       var _iframe_dl = $('&lt;iframe /&gt;')
                         .attr('src', url)
                         .hide()
                         .appendTo('body');
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>While the iframe is correctly printed in html code, it doesn’t have the expected behaviour: no download file popup appears after loading the page. Any help on why?</p>