How to make download button in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make download button in html?

I want to know how to make download button.

17th Feb 2017, 3:36 PM
Devashish Mishra
Devashish Mishra - avatar
5 Answers
+ 9
@Harshit Gupta: Providing the <a> with only an url 'href' attribute without the 'download' attribute will induce browser to firstly try to display it ( load it as a new web document/page ) rather than download the file, according to protocol ( http ) and recognized mime-type ( a 'jpg' file will be displayed, an 'exe' file could be executed on a windows system if user authorized it, and so being just temporarly dowloaded ^^ ). Using 'ftp' protocol can fix it, as it stands for 'File Transfer Protocol'...
8th Apr 2017, 1:10 PM
visph
visph - avatar
+ 6
In the href attribute of <a> tag, provide the complete url of the file. Include any prefixes such as HTTP:// or FTP:// and also include the file extension such as .JPG or .EXE.
2nd Apr 2017, 11:25 AM
Harshit Gupta
Harshit Gupta - avatar
+ 2
With Html5, you can use the 'download' flag attribute of <a> html element ( or <area> ), to download a link instead of navigate to it: <a href="url_of_file_to_download" download>Get the file!</a> With setting a value to this attribute, you can specify the name wich will be attribute to the dowloaded file on client side...
17th Feb 2017, 4:26 PM
visph
visph - avatar
- 1
<form> <input type="Button" Value="Button Text" onclick="window.location.href='download location' </form> thats what i know.
17th Feb 2017, 3:57 PM
Achsan Anugrah (XanDz18)
Achsan Anugrah (XanDz18) - avatar
- 2
@Achsan Anugrah use input type = "submit"
17th Feb 2017, 4:13 PM
Varun Moghe
Varun Moghe - avatar