Jack
Jack

Reputation: 77

Download .mp3 file instead of playing them in firefox or chrome?

I am working on wordpress website and i want to save mp3 file in my pc. But when i click on link, it open in same/new tab and start playing. But i wanna that whenever user click on download button then mp3 will start downloading. Can anyone help me how can I download an audio file (mp3) from a link and save it to my pc.

<td data-th="Download Sound"><a href="https://www.example.com/meditation.mp3"><img title="Download MP3" src="https://i.imgur.com/jUu9ky3.png" alt="Download MP3" width="200" height="60" /></a></td>

Upvotes: 1

Views: 3415

Answers (2)

lx1412
lx1412

Reputation: 1200

Give a tag a download property

       <td data-th="Download Sound">
           <a href="https://www.example.com/meditation.mp3" download="meditation.mp3">
              <img title="Download MP3" src="https://i.imgur.com/jUu9ky3.png" alt="Download MP3" width="200" height="60" />
          </a>
        </td>

Upvotes: 2

Abdul Basit
Abdul Basit

Reputation: 1382

Try this, it worked for me

<a href="filepath" download> Download link </a>

Upvotes: 2

Related Questions