I hate it when sites complicate loading so much and use hacks instead of the good old link .
Dead simple version:
<a href="file.zip">Start automatic download!</a>
It is working! In every browser!
If you want to download a file that is usually displayed inline (for example, an image), then HTML5 has a download attribute that forces the file to be downloaded. It also allows you to override the file name ( although there is a better way to do this ):
<a href="report-generator.php" download="result.xls">Download</a>
Version with Thanks Page:
If you want to display "thank you" after downloading, use:
<a href="file.zip" onclick="if (event.button==0) setTimeout(function(){document.body.innerHTML='thanks!'},500)"> Start automatic download! </a>
The function in this setTimeout may be more advanced and, for example, load the full page via AJAX (but do not leave the page - do not touch window.location and do not activate other links).
The fact is that the download link is real, you can copy, drag, intercept it with the help of download accelerators, get :visited color, do not reload if the page remains open after restarting the browser, etc.
Here is what I use for ImageOptim
Kornel Nov 18 '08 at 23:16 2008-11-18 23:16
source share