Issue
I want to show user a popup like shown below when he clicks on a "Download music" link?
If I use following code then after clicking on a link opens up browser embedded Music player like Apple RealTIme..
<a href="../mp3/horse.mp3" target="_blank">Click to download</a>
How can I prevent browser from running Music (Without disabling/removing this plugin).
I want my browser should download Music and should not play it!
Solution
First, remove the onclick
attribute from the anchor. You don't need to involve JavaScript for this.
Second, have your server return a content-disposition: attachment
HTTP response header when the mp3 is requested. How you do this depends on your server. For example, in Apache, without involving a server side programming language you can use a Header
directive. Or, see an example in Java (although you should set the correct content-type
for an mp3).
Answered By - Quentin
Answer Checked By - David Marino (JavaFixing Volunteer)