Disable right click of your website

Saturday, June 18, 20160 comments

Disabling right click of your website or blog is a nice way to hide your page source from being viewed but now a days, there seems to be another major problem for bloggers and that is “content stealer”. Due to massive amount of content stealing, we bloggers are not getting what we are supposed to get from blogging and even the page ranks of the original blogs are dropping day by day. I hope someday we can get rid of those copy bloggers but if you wait for that day to come, you are totally gonna get robbed. Till then, what you can do is, you can simply disable your content selection which I have already written how you can do it using CSS and including that, you should also disable your “right click” because your contents can be easily copied if they can get access to your page source.

The solution for disabling your right click is very easy which I’m about to show you using 2 methods. The first one will be using “JavaScript” and the second one will be more easier which is by using a small HTML tag. I won’t make separate steps to show how it’s done on blogger and WordPress blogs because no matter which platform you are using, it will be the same.

Method 1-
The first method uses a small JavaScript which will be very helpful for you if you want to disable right click of your blog. Once someone presses the right click while viewing your blog, it will show an alert message “Right Click Disabled!”. All you need to do is, add the below code above the closing </body> tag of your webpage

<script language=JavaScript>
var message="Right Click Disabled!";
function clickIE4(){
if (event.button==2){
return false;
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
if (document.layers){
else if (document.all&&!document.getElementById){
document.oncontextmenu=new Function("alert(message);return false")

Save it and you are done. This method is useful but as you know, JavaScript affects your page load time so, I would recommend you to use the second method.

Method 2-

This one is very simple and also, it won’t affect your page load time because it uses a plain HTML tag. To disable your right click using HTML, simply replace your <body> tag with the below code.

<body oncontextmenu="return false;">

That’s all you gotta do. Save it and you are done.
Share this article :

Post a Comment

Support :
Copyright © 2016. NEEL COM

powered by Blogger