In modern browsers that support HTML5, the following is possible:
<a href="link/to/your/download/file" download>Download link</a>
You also can use this:
<a href="link/to/your/download/file" download="filename">Download link</a>
This will allow you to change the name of the file actually being downloaded.
Answer from Felix G. on Stack OverflowIn modern browsers that support HTML5, the following is possible:
<a href="link/to/your/download/file" download>Download link</a>
You also can use this:
<a href="link/to/your/download/file" download="filename">Download link</a>
This will allow you to change the name of the file actually being downloaded.
This answer is outdated. We now have the
downloadattribute. (see also this link to MDN)
If by "the download link" you mean a link to a file to download, use
<a href="http://example.com/files/myfile.pdf" target="_blank">Download</a>
the target=_blank will make a new browser window appear before the download starts. That window will usually be closed when the browser discovers that the resource is a file download.
Note that file types known to the browser (e.g. JPG or GIF images) will usually be opened within the browser.
You can try sending the right headers to force a download like outlined e.g. here. (server side scripting or access to the server settings is required for that.)
Create downloadable link to file | SharePoint
How to create a download link to a local file on my computer to send in an http request?
What online storage lets you create a "direct link" to a download of your files ?
How can I mass-download all the files in the links of a website? *I AM DESPERATE*
Videos
This is probably a super simple question to answer, but I've yet to find an answer to it by searching. How can I provide a link to have a file download? For example, if I had a document on my webpage, and someone wanted a copy of it, they would click on the link and it would download. How difficult is that to implement? Thanks!
The API I am working with allows me to upload a file from a URL onto their application.
I was able to do this by using a direct download link to a file on my google drive. I simply put that direct download link into the url parameter of the http request.
How can I do something similar with a file on my local computer? Is there some way I can create a download link, similar to the google drive one, which I can then just use for the url parameter and then send the request so their server has my file?