3 ms·
On forcing PDFs to download: please don't. Most often I'd rather view it in the browser and then decide whether to save.
by abecedarius 13y ago
On forcing PDFs to download: please don't. Most often I'd rather view it in the browser and then decide whether to save.
- daker 13y agoThis was just an exemple :)
- gbog 13y agoSurte, but one cannot underline enough the importance of relevant and correct examples. May I suggest something like "<a href='verybiglogoftheday/' download='log-2013-12-11.txt'>"
- daker 13y agoYes, look at my example (http://jsbin.com/utugex/1/edit http://jsbin.com/utugex/1/edit), the href is pointing to an .html file, so in the normal case the browser will display the content of the page but with the download attribute the browser will be forced to download it as "myfile.pdf".
- Wilya 13y agoMore than the "force download" aspect, it's mostly useful to specify a filename when linking to a download where the filename can be strange or non-existent, like a data: url, or some remote resource you don't completely control. I'm pleasantly surprised to find out it now works correctly on Firefox. It was Chrome only last time I checked.