So you decided to disable copy-paste function for the Blogger blog? This article will help you to understand the pros and cons of doing so, and how you can disable copy-paste.
When you write a blog on the Blogger content management system and want nobody to copy the content, you can follow this guide. Blogger supports XML theme. We’ve to apply some code to the XML theme file to generate a protected HTML output.
First, we’ll understand how we can disable copy-paste function for the whole page and a specific part. That will give more control over the Blogger blog.
How to disable Copy Paste of Complete Page in Blogger
When you disable copy-paste of complete Blog, your blog will not support right-click, ctrl+c, ctrl+v, or selection tool in mobile.
The following script will disallow any function under the body section. You’ve to edit the Blogger XML file and paste this code just above the </body> tag. The </body> tag can be found in the last lines of the XML Blogger theme.
<script type="text/javascript">
$(document).ready(function() {
//Disable cut copy paste
$('body').bind('cut copy paste', function(e) {
e.preventDefault();
});
//Disable mouse right click
$("body").on("contextmenu", function(e) {
return false;
});
});
</script>
The above script will perform two actions,
- The first part will disable copy-paste function from the page,
- The second part will disable the right click of the mouse.
This code will now will not allows website visitors to copy any content from the page.
Want to Protect a specific part like content only? (Recommended)
The below code is most useful as this will function only for a specific part of the page. You can paste the code just above the </body> tag in the XML theme file of the Blogger blog.
<script type="text/javascript">
$(document).ready(function() {
//Disable cut copy paste
$('article').bind('cut copy paste', function(e) {
e.preventDefault();
});
});
</script>
You’ve to paste save this code into the theme HTML and done. Whatever content you’ll write will be protected. Please note that this code will not give any warning like content is protected, which will irritate the visitors.
Suppose a visitor wants to read a complete article of your blog, and you provided an external link for reference. In that case, the user will right-click from the mouse, and if there is no response of click, it will annoy the user. In that case, the user may leave your website, which is called pogo-sticking. So you’ve to take care of the website visitors too.
If you want to disable right-click too, you can paste the following code instead of the above. But we’ll recommend you to use the above code.
<script type="text/javascript">
$(document).ready(function() {
//Disable cut copy paste
$('article').bind('cut copy paste', function(e) {
e.preventDefault();
});
//Disable mouse right click
$("article").on("contextmenu", function(e) {
return false;
});
});
</script>
If the above code is not working: you are using a basic HTML theme that is not SEO friendly as the above code will work only with the HTML5 page structure theme. In that case, you can download the Oyedad Blogger theme designed by our SEONeurons Team.
I hope you liked our article on disable copy-paste function in Blogger. In case of any doubt or query, feel free to ask in the comment section provided below.
Wow This is really an amazing article, It will help me to protect my content to steal.
Sir you know how to do this but you dont applied this to your web. Why? Is there any bada effect if we put this script on our blog? Thank you
Thanks. you saved my day.
Thank you so much ❤️❤️