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?
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>
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.
Simply use the "download
" attribute of HTML5 to create download link
<a href="https://example.com/fileToDownload.pdf" download="filename">Download</a>
OR you can open link in new tab using code below to view file in browser
<a href="https://example.com/fileToDownload.pdf" target="_blank">View</a>
target="_blank"
is used to open link in new tab, so if you want to open files like PDF/Jpeg/png file in browser.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly