w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it

a download attribute

The download attribute on the a element:

Warning: download attribute is currently supported in Firefox and Google Chrome


1.download=resource name<a> href="filetest.pdf" download> ... <⁄a>>
<a> href="filetest.pdf" download="a.pdf"> ... <⁄a>>

Video demonstration a download attribute

HTML5 a download attribute Tutorial

min video details
00:06 the download attribute on the a tag allows you to download a resource instead of navigating to it
00:09 this pdf file represents a resource
00:19 adding the download attribute to the 2nd a element
00:28 this link allows us to navigate to the testfile.pdf resource
00:32 testfile.pdf was opened in the browser window
00:35 this link allows us to download the resource
00:50 download attribute, values:
- a name (your choice) for the file
01:12 - in Firefox browser: the file extension is required
01:35 - in Chrome browser: the file name is ignored: e.g. testfile.pdf instead of a.pdf
01:49 Browser tweaks:
althought the download attribute is missing, we can still download the pdf file by changing the content type⁄action association in Firefox
02:12 the testfile.pdf resource was downloaded though the download attribute is absent on the a tag
a intro a browser display a parents - childrena content model: transparenta warninga syntaxa href attributea hreflang attributea rel attributea target attributea type attributea itemprop attribute