Someone please share with me the code that enables someone to download a song on a website by clicking on it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Someone please share with me the code that enables someone to download a song on a website by clicking on it

27th Jul 2020, 10:40 AM
Uyoya Mubita
Uyoya Mubita - avatar
3 Answers
+ 6
<a href="/songs/song.mp3" download>Download mp3</a> you can simply use download attribute on <a> tag https://www.w3schools.com/tags/att_a_download.asp
27th Jul 2020, 11:00 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 5
You can use <audio> tag of html5 to add music to your website. <!DOCTYPE html> <html> <body> <audio controls> <source src="horse.ogg" type=”audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> </body> </html> audio controls will give your audio file the controls like play, pause or download the audio. The source tag will allow us to specify alternative audio files which the browser may choose from. The browser will use the first recognized format. Any other text written between audio tags will be displayed only if the browser doesn't support audio.
27th Jul 2020, 11:01 AM
VIRTUAL
VIRTUAL - avatar
0
Thanks guys
27th Jul 2020, 11:13 AM
Uyoya Mubita
Uyoya Mubita - avatar