Many times, you may want to prevent images, videos, and text of your site to get downloaded or copied. To do so, you can disable the right-click functionality on your site. In this way, the user won't be able to save or download the images and other data from your site. To disable the copying and downloading of text, images, or videos from your site, follow the steps mentioned below:
<script language=JavaScript>
var message = "You cannot copy the data!";
function clickIE4() {
if (event.button == 2) {
return false;
}
}
function clickNS4(e) {
if (document.layers || document.getElementById && !document.all) {
if (e.which == 2 || e.which == 3) {
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = clickNS4;
} else if (document.all && !document.getElementById) {
document.onmousedown = clickIE4;
}
document.oncontextmenu = new Function("return false")
document.oncontextmenu = new Function("alert(message);return false")
</script>
Now, the copying and downloading of data not be allowed on your site. When the user will try to do so, the popup will open up informing copying data is not allowed.