Skip to main content

Right-click Image Protection: Protect Images from Theft

Right-click image protection prevents site visitors from copying, saving, or downloading images on your website by disabling the right-click function. This can safeguard your images and prevent unauthorized use or distribution.

How to Disable the Right-Click Menu

You can stop right-clicking with a script (copy and paste it from this page if you want to) in the <HEAD> section of your HTML code.

<script type="text/javascript">

var msg="mouse right click disabled(or any message you want)";

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(msg);
return false;
}
}

if (document.layers) {
if (e.which == 3) {
alert(msg);
return false;
}
}
}

if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

</script>

Summary

You can stop site visitors from copying, saving, or downloading images on your website by disabling the right-click function. Stop right-clicking with a script and add it in the <HEAD> section of your HTML code. See the provided script above.