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?
Works on Chrome, firefox and IE8 and above:
Be sure to serve up the file without a no-cache header! IE has issues with this, if user tries to "open" the download without saving first.
I recently solved it by placing the following script on the page.
I agree that a meta-refresh would be nicer but if it doesn't work what do you do...
This is what I'm using in some sites (requires jQuery).:
The file is downloaded automatically after 1 second.
I had a similar issue and none of the above solutions worked for me. Here's my try (requires jquery):
Usage: Just add an attribute called
data-auto-download
to the link pointing to the download in question:It should work in all cases.
This seemed to work for me - across all browsers.