download
attribute on the button's link, optionally specifying a custom filename.To make a Webflow button download a PDF file directly—without opening a new tab or redirecting—the key is setting the correct link settings and file upload behavior.
J
or click the photo icon in the left sidebar).Add the download
attribute to the link. Webflow’s Designer does not let you natively apply the download
attribute via the UI, so you need to use a little workaround:
Give the button a unique custom class name, e.g., download-button
.
Go to the Page Settings (gear icon next to the page name).
Scroll to the Footer Code section and add this:
``
This script finds the button’s anchor link and adds the download
attribute, which tells browsers to download the file instead of opening it.
To rename the file when it's downloaded, modify the download
attribute like this:
``
Replace YourFileName.pdf
with the name you'd like users to see when downloading.
To let users download a PDF on button click in Webflow without redirecting or opening a new tab: upload the PDF to Assets, link it to a button, and use custom script to add the download
attribute to that link. This forces most browsers to download the file locally.