HTML <a> downloadAttribute
Examples
Click the link to download the image:
<a href="/images/logo.png" download="/images/logo.png">
Try it Yourself »
Browser Support
The numbers in the table specify the first browser version that fully supports the attribute.
| Element | |||||
|---|---|---|---|---|---|
| download | 14.0 | 13.0 | 20.0 | 10.1 | 15.0 |
Definition and Usage
The download attribute defines the address of the download link.
The href attribute must be specified in the <a> tag.
The attribute can also specify the name of the downloaded file. The file name has no restricted value, and the browser will automatically add the suffix of the downloaded file (.img, .pdf, .txt, .html, etc.) to the end of the file name.
This attribute requires the download resource to be same-origin.
For more complete functionality, you can use a third-party JavaScript library:download.js。
Differences Between HTML 4.01 and HTML5
The download attribute is a new attribute for the <a> tag in HTML5.
Syntax
<a
download="filename">
Attribute Values
| Value | Description |
|---|---|
| filename | Specifies the file name. |
Other Extensions
HTML <a> Tag