![]() |
On a website, not all content needs to be displayed directly on the page. It is often necessary to share additional resources—such as PDF manuals, Word forms, presentations, or compressed archives—that the user needs to save on their device for offline consultation or printing.
The purpose of this guide is to explain how to make these resources easily accessible. You will learn not only how to physically link a file to your web page, but also how to optimize the download experience, ensuring the user's browser correctly recognizes the file and saves it intuitively.
1. The Basic Method (HTML)
To create a link to a document, you must use the href attribute within an <a> tag.
Syntax:
<a href="path/to/your/file.pdf">Click here to download the document</a>
Explanation of components:
href="...": Indicates the path where the file is located. It can be a relative path (if the file is on your server) or an absolute one (a complete URL).- Link text: The text visible to the user (e.g., "Download the manual").
2. User Experience (UX) Tips
To make downloading more intuitive, I recommend adding two specific attributes:
The download attribute
If you want to force the browser to download the file instead of opening it (very useful for PDFs that browsers usually open in a dedicated tab), add the download attribute:
<a href="documents/report-2026.pdf" download>Download the PDF report</a>
Indicating format and size
It is always good practice to inform the user about what they are about to download. You can add this information directly into the link text:
<a href="manual.pdf" download>Download User Manual (PDF, 2.5MB)</a>
3. Managing files on the server
To ensure the link works, make sure to follow these rules:
- Organization: I recommend creating a dedicated folder in your project (e.g.,
/assets/downloads/or/files/) to keep documents separate from images or scripts. - File names: Avoid spaces, special characters (like
à,è,ì), and capital letters in file names.
4. Full Example
Here is how the code would look on a structured page:
<h3>Available Documentation</h3>
<ul>
<li>
<a href="/files/company-brochure.pdf" download>
Download 2026 Brochure (PDF, 1.2MB)
</a>
</li>
<li>
<a href="/files/price-list.zip" download>
Download Complete Price List (.ZIP)
</a>
</li>
</ul>
A note on security
If you are uploading files to a remote server or via a CMS (like WordPress), ensure the folder containing the files has the correct read permissions; otherwise, the browser will return a 403 Forbidden error when the user tries to download the document.
Follow me #techelopment
Official site: www.techelopment.it
facebook: Techelopment
instagram: @techelopment
X: techelopment
Bluesky: @techelopment
telegram: @techelopment_channel
whatsapp: Techelopment
youtube: @techelopment
