Saturday, July 23, 2016
How to Disable Right Click on Blogger to Prevent Copying Content
I run an Educational blog where students can find latest school News in Nigeria so I noticed some people are copying my blog content to their blog and they claim to be the owner of the post. What I did to curb this was to add a simple JavaScript code to my blog to disable right click option to prevent others from copying contents and images on my blog.
?
Today, I will explain how, and the code I added to my blog to prevent this.
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
If you follow the tutorial above carefully, nobody will be able to copy your blog contents and images again.
?
Today, I will explain how, and the code I added to my blog to prevent this.
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
If you follow the tutorial above carefully, nobody will be able to copy your blog contents and images again.