Use the download attribute to specify that the target will be downloaded when a user clicks on the hyperlink:
The download
attribute specifies that the target (the file specified in the href
attribute) will be downloaded when a user clicks on the hyperlink.
The optional value of the download
attribute will be the new name of the file after it is downloaded. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).
If the value is omitted, the original filename is used.
The numbers in the table specify the first browser version that fully supports the attribute.
* Chrome 65+ and Firefox only support same-origin download links.
<area download="filename">
Value | Description |
---|---|
filename | Optional. Specifies the new filename for the downloaded file |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The area download attribute</h1>
<p>Click on the sun or on one of the planets to download its content.</p>
<img src="https://horje.com/avatar.png" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="https://horje.com/avatar.png" download>
<area shape="circle" coords="90,58,3" alt="Mercury" href="https://horje.com/avatar.png" download>
<area shape="circle" coords="124,58,8" alt="Venus" href="https://horje.com/avatar.png" download>
</map>
<p><b>Note:</b> The download attribute is not supported in IE, Safari or Opera version 12 (and earlier).</p>
</body>
</html>
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |