How can I let end-users listening to my website's musics to play the songs, but reject their request if they are going to download the song via download manager or etc.?

For example, it would be nice if they only get a HTML file or a 403 status code?


We are providing two kind of availability on our website, one is by radio streaming using IceCast and the other is playable songs for those who sign up. I knew something like cloud object storage architecture could save the webserver from providing the path of the file so in that case the user might lose the chance to download stuff directly, unless by recording the data, so I thought how may it be possible to do it without cloud object storage architecture, if possible.

I know that we can always circumvent everything, so I know it cannot be 100% working, but at least make it harder to download and reduce the chance of detecting the original file path.

  • See also Discouraging users from copying images off a website?
    – Sjoerd
    Commented Sep 13, 2016 at 12:56
  • use streaming media instead of url-based files
    – dandavis
    Commented Sep 13, 2016 at 15:34
  • @dandavis wouldn't it be like live radio in that case? Shall I ask you to explain more? Commented Sep 13, 2016 at 19:05
  • that's exactly what it would be like, and a lot harder to save than discrete files.
    – dandavis
    Commented Sep 13, 2016 at 22:40
  • @dandavis alright, please read the updated part of the question. Thanks. Commented Sep 14, 2016 at 4:51

1 Answer 1


Short answer is you can't.

As you send the data from your server, it is out of your control. You have no control what so ever about what the client does with it. You can build all sorts of systems to try to differentiate requests for download from requests to play, but you can not stop the client from sending a play request when they actually intend to download. In fact, if the song is played on the client it is already "downloaded" - all the user needs to do is save the downloaded data.

This does not mean that you can not make it harder for the user to save the song. Techniques to do this are called "digital rights management" or DRM, and what they all have in common is that they can be defeated. In the case of sound it is trivial - just record the outgoing audio... However, it might be enough to deter the not very determined attacker.

In the case of audio in the browser, what you probably want to look at is Encrypted Media Extensions. Browser support is not perfect for that, though, and I would think twice before using it.

  • 2
    Next time someone does something like this, I'll get a 3.5 mm stereo male to 3.5 mm stereo male cable and hook the sound card's output up to its input. Or stop visiting their site.
    – user
    Commented Sep 13, 2016 at 10:38
  • Thanks for your quick answer, I voted up but yet I need to ask you about more detail. So if there is no way, what is occurring on coursera.com or similar websites that we cannot download their content ( specially mp4, mp3, Ogg)? Commented Sep 13, 2016 at 11:34
  • 1
    You can download the Coursera content, it is just not as easy as right clicking. I don't know what system they use - I checked out their site, and I think I need to sign up to see any content, so I can not investigate. But there is no way for them to prevent me from just using a screen recording software to grab the video.
    – Anders
    Commented Sep 13, 2016 at 11:46
  • @Anders Yes you can if you sign up and pay for the course, but there should be something like using keys or whatsoever. I know nothing can prevent us from anything, I just needed to know how is it possible to do this. Commented Sep 13, 2016 at 18:26
  • 1
    @ParsaX As I said, if you really want to do this my best bet would be EME.
    – Anders
    Commented Sep 14, 2016 at 7:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .