Values for the download attribute

29 views
Skip to first unread message

Christopher Finazzo

unread,
Mar 14, 2020, 8:45:58 PM3/14/20
to BBEdit Talk
When checking the syntax of my document, I am getting validator warnings that the syntax of my download links is incorrect. BBEdit tells me that the download attribute requires a value inside the anchor, but the W3C's Nu checker has no such complaints.

Is BBEdit's validator just extra stingy? :)
Screen Shot 2020-03-14 at 8.38.27 PM.png

Neil Faiman

unread,
Mar 14, 2020, 10:27:34 PM3/14/20
to BBEdit Talk Mailing List
On Mar 14, 2020, at 8:45 PM, Christopher Finazzo <chris....@gmail.com> wrote:

When checking the syntax of my document, I am getting validator warnings that the syntax of my download links is incorrect. BBEdit tells me that the download attribute requires a value inside the anchor, but the W3C's Nu checker has no such complaints.

This is from he HTML spec at whatwg.org:

The download attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. The attribute may have a value; the value, if any, specifies the default file name that the author recommends for use in labeling the resource in a local file system. There are no restrictions on allowed values, but authors are cautioned that most file systems have limitations with regard to what punctuation is supported in file names, and user agents are likely to adjust file names accordingly.

and

In some cases, resources are intended for later use rather than immediate viewing. To indicate that a resource is intended to be downloaded for use later, rather than immediately used, the download attribute can be specified on the a or area element that creates the hyperlink to that resource.

The attribute can furthermore be given a value, to specify the file name that user agents are to use when storing the resource in a file system. This value can be overridden by the `Content-Disposition` HTTP header's filename parameters. [RFC6266]


Christopher Finazzo

unread,
Mar 15, 2020, 4:33:01 PM3/15/20
to BBEdit Talk
Hi Neil,

Thanks for the quick reply, much appreciated.

I think this just was a case where I misremembered what to do. I think the first time I saw the download attribute being used was in Jeremy Keith's book years back. In it, I don't think he had a name inside anchors for examples of this behavior, so I assumed for the longest time it wasn't required.
Reply all
Reply to author
Forward
0 new messages