Sometimes you have items on your website that you want your customers to be able to download to their home computer. Things like large documents and PDF files, long videos, or songs. But these files are automatically opened in the browser window rather than saved as a download file.
The most common solution most web designers take is to add explanatory text next to the link suggesting that the customer use their browser options to right-click or ctrl-click and choose “Save File...” to download the link. But since many people don’t see those messages, this isn’t as effective, and can result in some annoyed customers.
This tutorial will show you how you can set up both the above method, and ask your readers to request the download. And it will also show you a trick for creating files that will be downloaded by nearly all web browsers, but that can still be used on the customer’s computer.
Time Required: 10 minutes
What You Need:
- The file to be downloaded.
- A web hosting provider
Get Your Customers to Do It
Upload the file you want your customers to download to your web server. Make sure you know where it is by testing the full URL in your browser. If you have the correct URL the file should open in the browser window.
- Edit the page where you want the link and add a standard anchor link to the document.
<a href="/documents/large_document.pdf">Download the large document</a>
- Add text next to the link telling your readers they need to right-click or ctrl-click the link in order to download it.
Right-click (control-click on a Mac) the link and choose “Save Link As...” to save the document to your computer
Change the File to a Zip File
If your readers ignore the instructions to right-click or ctrl-click, you can adjust the file to something that will be automatically downloaded by most browsers: a zip file or other compressed file type.
- Use your operating system compression program to turn your download file into a zip file. How to Zip Files On a Mac Zip Files on Windows
- Upload the zip file to your web server. Make sure you know where it is by testing the full URL in your browser window.
- Edit the page where you want the link and add a standard anchor link to the zip file.
<a href="/documents/large_document.zip">Download the large document</a>
- Most operating systems have some compression software built in. If yours doesn’t, you can look up “zip files” in a search engine to find a program to build them for you.
- You can use this technique for images, movies, music, and documents as well as PDF files. Anything you can compress as a zip file you can post to your site for download.
- You can also compress multiple files into one zip file, to let your customers download a bunch of files with one click.
- If none of the above methods appeals you can also force a download with PHP.