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?
If the menu bar is hidden, press Alt to make it visible. In the Internet Options dialog box, from the Security tab, select the Internet zone, and then click Custom level.... Scroll down to "Downloads". Under "File download" (IE 9) or "Automatic prompting for file downloads" (IE 8 or 7), select Enable.
File Download SettingsSelect Tools > Internet Options. Click the Security tab. Click Custom Level. About 1/3 of the way down the page, enable automatic prompting for file downloads and File download.
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.)
I hate when sites complicate download so much and use hacks instead of a good old link.
<a href="file.zip">Start automatic download!</a>
It works! In every browser!
If you want to download a file that is usually displayed inline (such as an image) then HTML5 has a download
attribute that forces download of the file. It also allows you to override filename (although there is a better way to do it):
<a href="report-generator.php" download="result.xls">Download</a>
If you want to display "thanks" after download, then use:
<a href="file.zip" onclick="if (event.button==0) setTimeout(function(){document.body.innerHTML='thanks!'},500)"> Start automatic download! </a>
Function in that setTimeout
might be more advanced and e.g. download full page via AJAX (but don't navigate away from the page — don't touch window.location
or activate other links).
The point is that link to download is real, can be copied, dragged, intercepted by download accelerators, gets :visited
color, doesn't re-download if page is left open after browser restart, etc.
That's what I use for ImageOptim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With