HTML download Attribute


The download attribute of the <area> element is used to set the name of the file to be downloaded which would download when user clicks on the hyperlink.

Following is the syntax −

<area download="file">

The file is the name of the file set for download.

Let us now see an example to implement the download attribute of the <area> element −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Learning</h2>
<p>Learn these technologies with ease....</p>
<img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/>
<map name = "tutorials">
   <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27"
   href = "/perl/index.htm" alt = "Perl Tutorial" download="perl" />
   <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial"
   href = "/html/index.htm" target = "_blank" download="html" />
   <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial"
   href = "/php/index.htm" target = "_blank" download="php" />
</map>
</body>
</html>

Output

Now, when you will click on let’s say “PERL”, the file will download as shown below −

Above, we have enabled the download option using the download attribute of <area> −

<area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27"
href = "/perl/index.htm" alt = "Perl Tutorial" download="perl" />


The download attribute is set with the name “perl”. This ould be the name of the file as well −

download="perl"

Updated on: 30-Jul-2019

107 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements