Global Header
1 Min Read

Right-click Image Protection: Protect Images from Theft

Home Blog General Right-click Image Protection: Protect Images from Theft
Email Headers

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.

  • I'm Pawan, a content writer at Bluehost, specializing in WordPress. I enjoy breaking down technical topics to make them accessible. When I'm not writing, you'll find me lost in a good fiction book.

Learn more about Bluehost Editorial Guidelines
View All

Write A Comment

Your email address will not be published. Required fields are marked *

Longest running WordPress.org recommended host.

Get Up to 61% off on hosting for WordPress Websites and Stores.

Table of Contents