HTML <area> download-eigenschap
Definitie en gebruik
download
Bepaalt het doel dat wordt gedownload wanneer de gebruiker op de hyperlink klikt (href-eigenschap bestand zoals opgegeven in)
download
De optionele waarden van de eigenschap worden de nieuwe naam van het bestand na de download. Elke waarde is toegestaan, de browser detecteert automatisch het juiste bestandsextensie en voegt het toe aan het bestand (bijvoorbeeld .img, .pdf, .txt, .html, enz.)
Als de waarde wordt weggelaten, wordt de oorspronkelijke bestandsnaam gebruikt.
Voorbeeld
Voorbeeld 1
Gebruik de download-eigenschap om te definiëren dat de doellevering wordt gedownload wanneer de gebruiker op de hyperlink klikt:
<map name="planetmap"> <area shape="rect" coords="0,0,114,576" alt="Sun" href="about_sun.html" download> <area shape="circle" coords="190,230,5" alt="Mercury" href="about_mercury.html" download> <area shape="circle" coords="228,230,5" alt="Venus" href="about_venus.html" download> </map>
Voorbeeld 2
Een waarde voor de download-eigenschap definiëren, die het nieuwe bestandsnaam van het te downloaden bestand zal zijn (bijvoorbeeld sun.htm in plaats van information_about_the_sun.htm):
<map name="planetmap"> <area shape="rect" coords="0,0,114,576" alt="Sun" href="about_sun.htm" download="sun"> <area shape="circle" coords="190,230,5" alt="Mercury" href="about_mercury.html" download="mercury"> <area shape="circle" coords="228,230,5" alt="Venus" href="about_venus.html" download="venus"> </map>
Syntax
<area download="filename">
Attribute value
Value | Description |
---|---|
filename | Optional. Specifies a new filename for the downloaded file. |
Browser support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
14.0* | 18.0 | 20.0* | 10.1 | 15.0 |
* Chrome 65+ and Firefox only support same-origin download links.