Search code examples
javascripthtmlinternet-explorermeta-tags

How to start automatic download of a file in Internet Explorer?


How do I initialize an automatic download of a file in Internet Explorer?

For example, in the download page, I want the download link to appear and a message: "If you download doesn't start automatically .... etc". The download should begin shortly after the page loads.

In Firefox this is easy, you just need to include a meta tag in the header, <meta http-equiv="Refresh" content="n;url"> where n is the number of seconds and url is the download URL. This does not work in Internet Explorer. How do I make this work in Internet Explorer browsers?


Solution

  • SourceForge uses an <iframe> element with the src="" attribute pointing to the file to download.

    <iframe width="1" height="1" frameborder="0" src="[File location]"></iframe>
    

    (Side effect: no redirect, no JavaScript, original URL remains unchanged.)