New in HTML5.

Using <a> To Download Rather Than Open Linked Resource

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
How To Use a (For Creating Hyperlinks) In HTML
What does Using <a> To Download Rather Than Open Linked Resource do?
Directs the browser to download the linked resource rather than opening it.

Code Example

<a href="/wp-content/uploads/flamingo.jpg" download>Download this picture of a flamingo.</a>

Force a download

When using this attribute, you are forcing a particular behavior on the user, which they may or may not prefer. Therefore, be extremely judicious in employing this attribute. It probably should not be used for any type of content that can be viewed in the browser, including PDFs and most images. Users can always choose to download these resources rather than opening them in the browser. If you specify download, you take away their choice to view it in the browser.

Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for download

iefirefoxchromeedgesafariopera
Not supported.444813Not supported.34