Friday, 29 June 2012

How to Disable Right Click on Blogger to Prevent Copying Content

The simple JavaScript code is:
<script>
var message="Right click is 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>

How to Add the Code to Blogger Blogs

#1. Login to Blogger > Go to Layout > Add a Gadget > Click on HTML/JAVASCRIPT

#2. A window will pop out, then paste the JavaScript above into the pop up window.

#3. Now click on Save

When you will try to do right click, a message will tell you that “Right click is disabled” , and if you want to change this words “Right click is disabled” Then simply find it in code and replace it.

1 comment: