How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML5 ?
In this article, we will learn to specify the target to a link when opened by the user which will further download the image or any other file. This link is used when the user needs to directly download the file when clicked on hyperlink.
In order to do that we have to use an attribute called download which is used in <a> tag. It is used to download the element when the user clicks on the hyperlink and used only when href attribute is set. We can also provide a value to it, which will give a name to the downloaded file.
<a href = "file" download = "file name">
Output: We can see that the value which we gave in the download attribute is shown as the name of the downloaded file.
My Personal Notes arrow_drop_up
Please Login to comment...