2

I have audio Element Here

<audio controls preload="metadata">
    <source src="mp3FileName" type="audio/mpeg">
       Your browser does not support the audio element.
</audio>

with source "mp3FileName" I have separate download button

<a class="btn btn-primary" href="mp3FileName" download>Download audio here</a>

but when I click it it just opens _blank audio source just like that

audio when clicked download button

I want to instant download when button is clicked. how can it be done?

Thanks for answers and sorry Guys I forgot that it's written on VueJs Like That

<a class="btn btn-primary" :href="mp3FileName" download>Download audio here</a>

reason why it is used :href is because "mp3FileName" is from Vue Scripts

donxnik
  • 55
  • 6
  • 2
    Does this answer your question? [Is it possible to initiate a download prompt in the browser for recognized MIME types using only JavaScript (client-side approach)?](https://stackoverflow.com/questions/7763505/is-it-possible-to-initiate-a-download-prompt-in-the-browser-for-recognized-mime) – Joachim Rohde Sep 28 '20 at 07:08
  • Check if your file **extension** and **path** are correct – Becky Sep 28 '20 at 07:19
  • check this https://www.sanwebcorner.com/2017/07/auto-start-download-file-using.html – rock Sep 28 '20 at 07:29
  • https://stackoverflow.com/questions/53772331/vue-html-js-how-to-download-a-file-to-browser-using-the-download-tag This Helped me kinda caused CORS issue. – donxnik Sep 28 '20 at 08:48

0 Answers0