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?
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.