This content originally appeared on CodeSource.io and was authored by Pandu Rijal Pasa
We will learn how to use an HTML tag (the <a> tag) to directly download the file.
As we already know that the <a />
tag is used for a navigation link. As example, if we tried to locate user to some image, the code would be like this:
<a href="/folder/myImage.jpg">My Link</a>
We can use this tag to directly download the file that placed inside href
attribute. To do that, simply put download as a attribute inside that tag:
<a href="/folder/myImage.jpg" download>My Link</a>
Note: the href
should contain a link to the file. If not, it will just work as a navigation link.
The post Using HTML <a> Tag For Direct Download appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Pandu Rijal Pasa
Pandu Rijal Pasa | Sciencx (2021-02-20T11:15:58+00:00) Using HTML Tag For Direct Download. Retrieved from https://www.scien.cx/2021/02/20/using-html-tag-for-direct-download/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.