Force an attachment to download

Here’s something I found out today, instead of messing around with .htaccess configurations to force a file to download instead of show in the browser, you can simply add the “download” tag to the HTML Anchor link.

<a href="myfile.pdf" download>Click to Download</a>

Might save you some time / hassle trying to configure downloading PDF / DOC files on clients websites.

Posted in