HTML download Attribute
Example
<a href="img-boy.jpg" download>
Meaning
The download the link instead of navigating it.
Tips and Notes:
- download only works for same-origin URLs, or the blob: and data: schemes.
- The download attribute is not supported in IE or Edge (prior version 18), or in Safari (prior version 10.1).
- Chrome 65+ and Firefox only support same-origin download links.
- There is no restrictions on allowed values
- The browser will automatically detect the correct file extension and add it to the file (.png, .pdf, .txt, etc.).
Standard Syntax
<element download="fileName">
Browser Support
Status
Applies to:
The download attribute can be used on the following element:
Attribute Values
Value | Description |
---|---|
download | (optional)fileName Can be used with or without a value |
More Examples
Example
<img src="img/desk.jpg" usemap="#image-map">
<map name="image-map">
<area target="_blank" download="Computer" alt="Computer" title="Computer" href="img/computer.png" coords="365,99,905,783" shape="rect">
<area target="_blank" download="Cup" alt="Cup" title="Cup" href="img/cup.png" coords="1047,672,97" shape="circle">
<area target="_blank" download="Mobile" alt="Mobile" title="Mobile" href="img/mobile.png" coords="960,385,1040,541" shape="rect">
<area target="_blank" download="Book" alt="Book" title="Book" href="img/book.png" coords="175,426,96,527,20,664,232,755,298,628,364,505" shape="poly">
</map>