Easy Way To Disable Right Click On Your Blog

Say you want to protect your images and hard work on your blog. You can simply do this by disabling the right click function, this would help disable copy and paste on your website. This would help protect your images most especially. This code isn’t perfect but it’s a very good way to warn people who want to take your graphics and photos.

In this quick tip, am going to show you how to disable right click both in blogger & WordPress

Disable Right Click on Blogger

  • First, log into your blogger dashboard, click on layout
  • click on add a Gadget on your blogger Layout opion
  • Choose HTML/JAVASCRIPT

Copy the following code and paste it into a gadget box on your sidebar.

<script language=javascript>
<!–

var message=”Rightclick disabled“;

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function(“alert(message);return false”)

// –>
</script>

If you have problem with copying the script, you can download the txt file here

Disable Right Click in WordPress

  • How over to Appearance
  • Click on Widget
  • Look for Custom HTML
  • Add or drag the custom HTML widget to the sidebar
  • Add the script above and save it, that should do the work.

Note: If you’d like a different message to pop up, change the phrase in blue to what every message you would want, but DON’T delete the quotation marks around the message.

Also check best ecommerce blogger templates

That’s it! Now your content is right click disabled!

Disable Right Click without showing popup
If you prefer not disable right click without showing any popup, you can also do that.

First in the Javascript code above, look for

var message=”Rightclick disabled“;

Delete that whole line above ( what it actually does is that it gets rid of the message but it still displays a Javascript popup). To remove the popup, look for:

alert(message);

delete that line also, and your right click code should work fine without showing any popup message. I don’t usually advise this because sometimes, the user may think something is wrong with his mouse. It’s advisable to give the user a popup message message saying that rightclick has been disable.

Okay, that’s it. Do leave a comment if you found this useful. If you have issues getting this to work, please contact using out contact page for assistance. or simply leave a comment.

This Post Has One Comment

  1. This is awesome, thanks. It worked perfectly

Leave a Reply

Close Menu