HostMonster Web Hosting Help

Right-Click Image Protection

Problem:

How can I protect the images on my website?

Solution:

You can stop right clicks 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>
        
Knowledgebase Article 131,558 views bookmark tags: click code image images javascript protect save saving script tips tricks (updated 1423 days ago)


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

Why don't my images display on my site? (updated 2074 days ago)
Knowledgebase Article 93,028 views tags: display image images link site website

I need to protect the /images folder to not show images when people type in the correct URL like www.mydomain.com/images/ to protect from prying eyes. (updated 1075 days ago)
Knowledgebase Article 62,572 views tags: hotlink htaccess protection

How do I view Thumbnails of images in a directory? How do I scale images? How do I convert an image to a jpg, gif, bmp, or png? (updated 2057 days ago)
Knowledgebase Article 87,969 views tags: images manager

Related Help Content

This tutorial will show you how you can password protect parts of your website by password protecting the folder(s) on your account. (updated 271 days ago)
Video "How-to" Tutorial 125,478 views tags: cpanel cpanelutilities login password protect

How do I password protect a folder on my website? (updated 271 days ago)
Knowledgebase Article 92,183 views tags: folder password protect

How do I setup Hotlink Protection? (updated 1076 days ago)
Knowledgebase Article 92,147 views tags: link protection

How do I Password Protect a single file on my website? (updated 1068 days ago)
Knowledgebase Article 107,246 views tags: file passwd password prompt protect secure single

I need help with my HTML code. Will HostMonster help me? (updated 2094 days ago)
Knowledgebase Article 75,126 views tags: code html website

How can I optimize my images? (updated 2094 days ago)
Knowledgebase Article 92,676 views tags: images optimize

Images in the Agora shopping cart not showing or showing broken link images. (updated 2091 days ago)
Knowledgebase Article 90,590 views tags: agora cart images

What is the .htaccess file and where can I find more information? (updated 806 days ago)
Knowledgebase Article 1,446,260 views tags: htaccess tips tricks