Streaming live at 10am (PST)

Custom <a> attribute 'download'


I have a link block which gets its URL from a CMS record. The URL points to a PDF. The link works and opens the PDF in the browser. So far, so good. But:

I would like to force the download of the PDF using the HTML5 download attribute in the link, like
<a href="file.pdf" download>Click here</a>
So I’ve tried using the custom link attribute in the link block settings in the designer. Unfortunately an attribute named “download” is not accepted saying “this is a reserved name”.

Any ideas how to add a download attribute to an a-element in Webflow?


We should be able to do it with custom attributes.

The correct syntax for download is:

<a href="path/file.jpg" download="Picture of an elephant">Download the picture of an elephant</a>

So it’s exactly a custom attribute. But the Download name is reserved by Webflow.

So, you can use a custom code element to address that. It works with CMS. As soon as you have a custom code element inside a dynamic list, you can inject some of you CMS data into the code. Here you’d possibly need to retrieve the URL of the file and the description of the download.

Select the URL, then the description, and click +Add field on the top right corner to link that portion of code to your database.

1 Like

Where is your pdf hosted at?

See this if you are using the popular file hosting sites:

Hi Vincent,
thanks for the hint. I see custom code is a workaround.
However, it’s a pity that Webflow blocks HTML standard attributes.

The PDFs are hosted at one of our subdomains - standard webhosting.

There’s maybe a good reason but I don’t know about it :slight_smile: Click attribute and a lot of cool others are blocked too.

@cyberdave is there any disclosable info about the reserved terms?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.