How to create download link using anchor tag in HTML?


I have a link of File created on amazon s3, now I would like to create a link to download the file inside table <td>, so How can I create download link using anchor tag <a> in HTML?


Asked by:- jaiprakash
0
: 55 At:- 11/20/2018 2:22:14 PM
HTML download-link-using-anchor-tag download






1 Answers
profileImage Answered by:- manish

It is easy to create download link using anchor tag using HTML 5 "download" attribute, here is an example

<a href="/yourURLHere" download> click to download <a/>

You can also specify the Filename of the file, which user will download as an example here

<a href="/long/file/url" download="fileName">
 Download with Filename
</a>
  • The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.
  • This attribute is only used if the href attribute is set.
  • The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).
  • If the value is omitted, the original filename is used.

Download attribute is supported by all major browsers like Chrome/Firefox, supported in IE 13 and above, safari 10.1 and above, Opera 15.0 and above.

2
At:- 11/22/2018 8:07:53 AM
Thanks works as needed. 0
By : jaiprakash - at :- 11/29/2018 3:57:24 PM





Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use