In order to create a download link, when a visitor to your website clicked a link that pointed to a non-HTML document like a PDF file, an MP3 music file, or even an image, those files would download to that person’s computer. Today, that is not the case for many common file types.
Instead of forcing a download on these files, today’s web browsers simply display them inline, directly in the browser viewport. PDF files will be displayed in the browsers, as will images. MP3 files will be played directly in the browser window rather than saved as a download file. In many cases, this behavior may be perfectly fine. In fact, it may be preferable to a user having to download the file and then find it on their machine in order to open it. Other times, however, you may actually want a file to be downloaded rather than displayed by the browser.
The most common solution most web designers take when they try to force a file to download rather than be displayed by the browser 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. This is really not the best solution. Yes, it works, but since many people don’t see those messages, this isn’t an effective approach and it can result in some annoyed customers.
To generate a Download Link for file download, click on the more options button to the right of your file. A drop-down list will appear. Select the Share option. A Download Link is immediately generated and you can share it with your friends and colleagues via email or simply copy it and paste it to other users via any messenger you have handy.
To generate a Download Link for folder download, click on the more options button to the right of your folder. A drop-down list will appear. Select the Share option. Then choose Share Download Link. A Download Link is immediately generated and you can share it with your friends and colleagues via email or simply copy it and paste it to other users via any messenger you have handy.
How to create a download link while Visitors Download a File
Upload the file you want your website visitors 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 you want to create a download link and 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, as opposed to that PDF which is read inline by the browser. A zip file or other compressed file type is a good option to use for this method.
Use your operating system compression program to turn your download file into a zip file.
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>
Tips to create a download link
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 collection of files with one click.
If none of the above methods is appealing, you can also force a download with PHP.
How to Create a Download Link
HTML5 allows you to force the visitor’s Web browser to download files, such as PDFs, instead of opening them in the browser. Alternatively, you can embed and display your PDF files inside the page, or let the Web browser display them instead of opening an external PDF viewer.
Forcing the Browser to Download the PDF File
Locate the place where you want to insert the link.
Open the HTML file in your choice. If you don’t have an editor, you can use Windows Notepad text editor to edit your Web pages.