Right-click Image Protection: Protect Images from Theft

Blog Security Right-click Image Protection: Protect Images from Theft
1 Min Read
right click image protection

Summarize this blog post with:

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.

  • Pawan Kandari is a Senior Content Writer at Bluehost specializing in web hosting, WordPress, WooCommerce, and AI-powered website building. For 6+ years, he’s helped freelancers and small businesses understand their options and pick the right hosting setup for their goals. He likes making complicated things simple. And writing that helps people decide, not just read. When he’s not writing, he’s got a book in hand or a Test match on screen. Read more from Pawan Kandari, and follow him on LinkedIn for SEO and eCommerce tips.

Learn more about Bluehost Editorial Guidelines

Write A Comment

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

Security that runs itself

Protect your site, visitors, and reputation with intelligent, always-on malware protection.

Table of Contents

Sign up to get even more hosting insights

Learn more about our Privacy Policy.