Thursday, June 28, 2012

How to Disable Right Click on website ?

Disable Right Click Blogger

Have people been stealing your images or content from your blog? Well with this script you can help protect your content by disabling the right click option. This script is not full proof and anyone who is computer literate will be able to get around this. However this will make it harder for people to steal your content and it may stop the idiots all together.

If you want the right click option to be disabled on all pages in your blog then follow the instructions below. If not then you can just place the code in the post that you want to disable it in. Make sure if you paste it in a post you do so in Edit HTML mode.

If you feel uneasy about adding coding directly into your template you can add this code into a HTML/javascript gadget instead. But its better to add it through your template for best results because some scripts may have a bleed over effect on your Page Elements as well. 

Design--> Edit HTML--> Ctrl+F--> Input </head> in the Find bar that comes up.

This should locate the </head> tag in your HTML page.

Place this code directly above the </head> tag.

<script type="text/javascript">
document.onmousedown=disable; //IE
message="Sorry no right click on this page!";
function disable(e)
{
if (e == null)
  { //IE disable
  e = window.event;
  if (e.button==2)
    {
    alert(message);
    return false;
    }
  }
document.onclick=ffdisable;  //FF
}
function ffdisable(e)
{
if (e.button==2)
  { //firefox disable
  e.preventDefault();
  e.stopPropagation();
  alert(message);
  return false;
  }
}
</script>
You can change the text in red to the alert message you wish to display when someone right clicks.
 More at http://www.tweakmyblogger.com/2010/11/disable-right-click.html

No comments:

Post a Comment