ArticleBlogger

How to Disable Copy Paste in Blogger or WordPress with Simple Method

How to Disable Copy Paste in Blogger or WordPress, Protect your Hard Work

disable-copy-paste-blogger
disable-copy-paste-blogger

When we write some genuine content on our web portal. And someone just copies our hard work and paste it on their own web portal. To avoid this, we must take action. We can do it by inserting this javascript on that page.

Copy below given JS code and paste this just above to closing tag of body element i.e. </body>.

This code using jquery so you can use the latest jquery code available.

Disable Copy Paste for the Complete Page

<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js' type='text/javascript'></script>
<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>

If you want to protect your whole page, then paste the above code in between just above </body> tag in theme HTML.

For WordPress users, you can apply this code in the edit theme, edit footer.php file. And paste it above the </body> tag.

This is all done, now understand how this works.

Want to Protect a specific part of the page?

To protect only a specific element container, you can use the following code for that

<script type="text/javascript">
$(document).ready(function () {
    //Disable part of page
    $('#id').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
});
</script>

Example
If you want to protect an article enclosed with id test12. You’re enclosing your article like this

<div id="test12">
Here is your content that you want to protect
</div>

then paste this code in between <body> and </body> tag of your theme/template/design, bind your article in between, and id like this.
Now your id for this article is test12, then the code for this will be

<script type="text/javascript">
$(document).ready(function () {
    //Disable part of page
    $('#test12').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
});
</script>

This will block your article include in your id test12. This code doesn’t affect your site’s speed as there will be no render-blocking due to this js code. How to Disable Right Click WP with and without plugin 2021.

These codes can be used in Blogger, Wordpress etc.

How you look at this article ?. If you face any problem implementing this js or not working please comment below.

Finally, your page code will look like for Full Page Copy Page Protection will be

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>
<body>
	<main>
		<article class="content1">
<header>
	<h1>This is a sample article</h1>
</header>
<h2>This is subheading of sample article</h2>
<p>This is paragraph of sample article.</p>
		</article>
	</main>
	<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js' type='text/javascript'></script>
	<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>
</body>
</html>

and your code for a specific part of the page will look like.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <main>
        <article class="content1">
            <header>
                <h1>This is a sample article</h1>
            </header>
            <h2>This is subheading of sample article</h2>
            <p>This is paragraph of sample article.</p>
        </article>
    </main>
    <aside>
        <p>I'm free, you can copy me.</p>
    </aside>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js' type='text/javascript'></script>
    <script type="text/javascript">
        $(document).ready(function() {
            //Disable cut copy paste
            $('#content1').bind('cut copy paste', function(e) {
                e.preventDefault();
            });
            //Disable mouse right click
            $("body").on("contextmenu", function(e) {
                return false;
            });
        });

    </script>
</body>

</html>

In this way, you can protect your pages from being copied, but this is not a good practice. As one can copy by using other methods, and this will also download grade user experience. That will finally impact on SEO of your website.

Ashok Kumar

Ashok Kumar working in the Search Engine Optimization field since 2015. And worked on many successful projects since then. He shares the real-life experience of best SEO practices with his followers on seoneurons.com. You also can learn Advance level SEO for WordPress, Blogger, or any other blogging platform. Stay tuned.

Related Articles

Leave a Reply

Back to top button