«   Previous tip Next tip   »

HTML: Use the anchor element download attribute to prompt the user to download a resource

12th May 2020
Use the anchor element download attribute to prompt the user to download a resource

The download attribute on an anchor tag pops up a Save dialog to download the resource, instead of navigating to it. e.g.

<a download href="cat.jpg">
    Download cat pic
</a>

Using an attribute value, such as download="cat-1.jpg" will also suggest a filename in the Save dialog.

«   Previous tip Next tip   »

Sign up to receive a developer tip, in the form of a gif, in your inbox each week