HTML download property
Example
Click the link to download the image:
<a href="/images/logo.png" download="/images/logo.png">Try it »
Browser support
The numbers in the table indicate the version number of the first browser that supports this property.
| Element | |||||
|---|---|---|---|---|---|
| download | 14.0 | 13.0 | 20.0 | 10.1 | 15.0 |
Definition and Usage
The download property defines the address of the download link.
The href attribute must be specified in the tag.
The property can also specify the name of the downloaded file. The file name is not restricted; the browser will automatically add the downloaded file's extension (.img, .pdf, .txt, .html, etc.) at the end of the file name.
This property requires the downloaded resource to be from the 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 property is new in HTML5 for the tag property.
Syntax
| Value | Description |
|---|---|
| filename | Specify the file name. |
HTML