How to stop downloads?

FrankCrimson

New Member
I noticed that when I upload an mp3 file to my site anyone who goes to the url for it can download it via right clicking. How can I make it so that visitors can only listen to the file and not be able to download it?

Thanks for your kind help in advance everyone.
 
Solution

This block of JavaScript code might help you.

One more thing is that this should be placed in the <head> </head> tag in your HTML file, this will completely prevent users from right clicking anywhere on your website.

This code should work for internet explorer and Netscape browser. For Firefox, you might want to test it out.

-Users can "escape" from this code by simply disabling JavaScript in their browser. Might want to find a better code.

You can modify this code how ever you want to fit what you need (e.g new alert sounds)



<SCRIPT LANGUAGE="JavaScript"><!--
var message = 'Please respect our Copyright.' ;
function clickie() {
if (document.all) {
alert(message);
return false; } }
function clickns(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2 || e.which==3) {
alert(message);
return false; } } }
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickns;
} else {
document.onmouseup=clickns;
document.oncontextmenu=clickie;
}
// --></SCRIPT>

I did not create this by whatever means, this work belongs to http://www.graphicsacademy.com/howto_preventcopy1.php
 
Last edited:
Thanks for this mate, it solves part of the problem, but do you have a more comprehensive method for protecting all of the contents of your site?
 
Back
Top