This site runs best with JavaScript enabled.

Force a file to download instead of open in browser

Kevin Beck

February 24, 2020

If you add the download attribute to an a link, it will tell the browser to download the file instead of opening it in the browser.

<a href="/path/file" download>Download file</a>

The download attribute works in all modern browsers, including MS Edge, but not Internet Explorer.

In the latest versions of Chrome, you cannot download cross-origin files (they have to be hosted on the same domain).