Connect with us

Tech

How to Force Mp3 Tag link to Download Instead of Play in Browser

Published

on

I included a link to a large MP3 file on my server. I noticed that whenever I clicked on it in Chrome, the file would not download, but would simply play within my browser.

That is not the behavior I wanted: playing in-browser like that over time might cause unnecessary bandwidth expenditure, but more importantly, I felt that playing in-browser would not be as convenient for some users that wanted to simply download the file.

I wanted to give the user the option. Anyway, it’s really easy to force an HTML-5 enabled browser (like Chrome) to force a link to download a file instead of playing in-browser.

All you need to do is include the word “download” anywhere in the anchor tag:

<a download href="yourfile.mp3">Download this File!</a>

Now if only all things were that easy.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.