How To

How to disable mouse click and copy paste in HTML – Blogger and WordPress

Disable right-click and Copy Paste in Blogger and WordPress

Why do we need to disable right-click and copy-paste on our blog? Do you know that someone can steal your work and take credit for your work?

You need to protect your work by disabling right-click on your posts and select text option on your blog. But the question is how to disable it? – Don’t worry in this post we will discuss it with source code? Let’s see them in action!

Disable Right Click Using JavaScript

Disable Right Click in Blogger

Disabling right-click in Blogger is very easy, you just need to follow the 3 steps given below:

Step 1. Log on to the Blogger Dashboard and select the blog you want to disable right-click on.

Step 2. Navigate to Layout, click on it and then click on Add new Gadget and select HTML/JavaScript.

Step 3. Copy the JavaScript code below and paste it in opened HTML/JavaScript gadget. Enclose the below JavaScript code with open and close JavaScript code ie.

<script language=javascript>
	function blockOne() { 
		if (document.all) {				
				return false;
			}
			}
	function blockTwo(e) {
		if (document.layers||(document.getElementById&&!document.all)) 
		{
		if (e.which==2||e.which==3) {			
			return false;
		}
		}
		}
	if (document.layers){
		document.captureEvents(Event.mousedown);
		document.onmousedown=blockTwo;
	}
	else {
		document.onmouseup=blockTwo;
		document.oncontextmenu=blockOne;
	}
		document.oncontextmenu=new Function("return false");
</script>

That’s all you are done! Open your page or post and try right-clicking over it. It will not allow you to right-click.

Disable Copy Paste i.e.. Content Copy Protection in Blogger

We can protect our content in Blogger from copying in two ways i.e.. Using CSS and Using JavaScript

Using CSS

We can protect Blogger content from copying in 3 steps:

Step 1. Log on to Blogger Dashboard

Step 2. Navigate to Theme > Customize > Edit HTML

Step 3. Find ]]></b:skin> and just before this paste the given below

Body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none; 
}

Step 4. And finally Save changes that’s all you are done!

Using JavaScript

Log on to Blogger Dashboard > Theme > Customize > Edit HTML

Find the </body>, just before closing body tag paste the JavaScript code below:

<script>
$(&#39;body&#39;).bind(&#39;copy cut drag drop&#39;, function (e) { e.preventDefault(); });
</script>

Save changes that’s all your work is done. Now no one can select your text for copying.

Disable Copy Paste in WordPress

Log on to WordPress Dashboard and then navigate to Appearance > Customize > Additional CSS and paste the code given below:

Body {
  user-select:none;
}

Disable Right Click On WordPress Website or Blog

In WordPress you are not required to write a single line of code. You can disable right click on WordPress blog or website just by installing any one of the following plugins:

  1. WP Content Copy Protection & No Right Click
  2. Disable right-click for WordPress
  3. No Right Click Images plugin

Conclusion

Finally, I explained How to disable mouse right click and copy paste methods in Blogger as well as WordPress with source code. I hope it will help you, if any query you have regarding this let me know in the comment or you can mail me at karunasingh@blogearns.com

KarunaSingh

Greetings to everyone. I am Karuna Singh, I am a writer and blogger since 2018. I have written 1250+ articles and generated targeted traffic. Through this blog blogEarns, I want to help many fellow bloggers at every stage of their blogging journey and create a passive income stream from their blog.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please disable your Ad blocker to get enhanced browsing experience.