{"id":9351,"date":"2022-10-06T05:04:11","date_gmt":"2022-10-06T05:04:11","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=9351"},"modified":"2022-10-06T05:04:11","modified_gmt":"2022-10-06T05:04:11","slug":"html-download-attribute","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/10\/06\/html-download-attribute\/","title":{"rendered":"HTML download Attribute"},"content":{"rendered":"\n<p>The HTML&nbsp;download&nbsp;attribute specifies that the target will be downloaded when clicking on the hyperlink. It is used only if the&nbsp;href&nbsp;attribute is set.<\/p>\n\n\n\n<p>The value of the attribute is the name of the downloaded file. The browser automatically identifies the correct file extension and adds it to the file (e.g., .img, .txt, .pdf,). The browser will use the original filename if the value is omitted.<\/p>\n\n\n\n<p>You can use the\u00a0download\u00a0attribute on the following elements:\u00a0&lt;a>\u00a0and\u00a0&lt;area>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax-2\">Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;tag download&gt;&lt;\/tag&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-attribute-download-span-attribute-used-on-the-lt-a-gt-element-4\">Example of the HTML&nbsp;download&nbsp;attribute used on the &lt;a&gt; element:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;Click on the  logo to download it:&lt;\/h1&gt;\n    &lt;p&gt;\n      &lt;a href=\"\/uploads\/media\/default\/0001\/01\/0710cad7a1017902166203def268a0df2a5fd545.png\" download&gt;\n        &lt;img src=\"\/uploads\/media\/default\/0001\/01\/0710cad7a1017902166203def268a0df2a5fd545.png\" alt=\"W3Docs\" width=\"190\" height=\"45\"&gt;\n      &lt;\/a&gt;\n    &lt;\/p&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-attribute-download-span-attribute-used-on-the-lt-area-gt-element-6\">Example of the HTML&nbsp;download&nbsp;attribute used on the &lt;area&gt; element:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;p&gt;Click on one of the HTML, CSS or PHP logo and download it:&lt;\/p&gt;\n    &lt;img src=\"\/uploads\/media\/news_gallery\/0001\/01\/thumb_316_news_gallery_list.jpeg\"  width=\"250\" height=\"150\" alt=\"block\" usemap=\"#blockmap\"&gt;\n    &lt;map name=\"blockmap\"&gt;\n      &lt;area shape=\"circle\" coords=\"50,32,25\" alt=\"html\" href=\"\/uploads\/media\/book_gallery\/0001\/01\/d450f0358f947dffb3af91195c3002600d74101b.png\" download&gt;\n      &lt;area shape=\"circle\" coords=\"218,115,25\" alt=\"css\" href=\"\/uploads\/media\/book_gallery\/0001\/01\/25521e981b34da57c8f51baddc5b76351b855818.png\" download&gt;\n      &lt;area shape=\"circle\" coords=\"195,32,28\" alt=\"php\" href=\"\/uploads\/media\/book_gallery\/0001\/01\/4bbee6698c4884f25c46010d61b658dd62d2c04f.png\" download&gt;\n    &lt;\/map&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The HTML&nbsp;download&nbsp;attribute specifies that the target will be downloaded when clicking on the hyperlink. It is used only if the&nbsp;href&nbsp;attribute is set. The value of the attribute is the name of the downloaded file. The browser automatically identifies the correct file extension and adds it to the file (e.g., .img, .txt, .pdf,). The browser will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[327],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9351"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=9351"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9351\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=9351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=9351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=9351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}