How do I disable right-click on images?

Earlier today, I posted ways you could get around people stealing your images. That post was focused on code that could be added to prevent users pinning your images to Pinterest.

Users that don’t want to mess around with their themes, can always install the NoPin WordPress Plugin created by Shawn Hooper. It can also be found on the WordPress Addon site; NoPin WordPress Plugin.

Interestingly enough, the script that Pinterest provided doesn’t seem to work with all WordPress themes. With some of the themes, I was still able to copy to Pinterest without an issues. A bit of research, and it seems that it might not work in some themes.

So… how are you going to keep people from copying your images? One workaround is disabling right click on your images. For a free dhtml script, I used the disable right click on images code, that’s located at Dynamic Drive.

How do I disable right click on my WordPress site?

  1. Click on Appearance tab
  2. Click on Editor
  3. Click on Footer (footer.php)
  4. Insert the code, listed below, on the line right above the </body> tag
<script language="JavaScript1.2">

/*
Disable right click script II (on images)- By
Dynamicdrive.com
For full source, Terms of service, and
100s DTHML scripts
Visit http://www.dynamicdrive.com
*/

var clickmessage="Right click disabled on images!"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>

For those that don’t want to install the above code, you can always pick up a wordpress addon that disables right clicking images; no right click plugin.

I’ve checked out both the code, and the plin in. Thus far, both have worked with various themes (10 thus far) that I’ve tried.

Because right click has been disabled, most users who use sites such as Pinterest, won’t be able to right click your image and pin on their board. It won’t stop all the copying, but it will decrease the amount that’s copied without permission. As mentioned in the post, how to disable our images from being pinned to Pinterest, a technically advanced user will still be able to copy your images.

 

 

 

Subscribe
Notify of
guest

CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Cris

Just as an FYI, your images can still be stolen with a simple screen print and pasting into any image editing software. The best you can do is to disable (if you want to go that far) and make sure you watermark your images over important elements/lines so that it cannot be cropped out without chopping off a good part of the image.
Cris recently posted..Year of Projects: Week 36

Mitch Mitchell

It can also be done by those of us who understand how to use Firefox; I’m just saying. lol Not that I ever steal images (imagine angel halo). lol
Mitch Mitchell recently posted..What Could You Do In 36 Hours?

Leah

I used to utilize wp-protect plugin in my blogs. This disable right-click on images, contents, etc. It is really frustrating when someone stole your images that you bought for dollars.

By the way, this tutorial is very helpful. This is an additional info for me to apply for my blogs…
Leah recently posted..Omnitrition