I am making an audio player, and I would like to include a button that downloads the current track. I have tried the common solutions people suggest, but these only open the .mp3 in a new tab and play it. This is what I am using:
document.getElementById("dlButton").addEventListener("click", function(){
window.location = "tracks/CFKZ.mp3";});
I saw another solution here on stack overflow:
<form method="get" action="file.doc">
<button type="submit">Download!</button>
</form>
I don't understand this. It doesn't make sense to me why a download button would need to send information to the file that is to be downloaded.