How to Disable Copy Paste of a article.

When we write important article on our web portal, we do write it with very hard work. and Someone just copy it and paste it on their own web portal. To avoid this we must take an action. We can do it by inserting this javascript in that page.

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

If you want to protect your whole page then paste the given code in between <body> and </body> tag

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

or if you want to disable copy paste function of a part of an article then do this

<script type="text/javascript">
$(document).ready(function () {
    //Disable partof 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 and bind your article in between and id like this.
Now your id for this article is test12 then code for this will be

<script type="text/javascript">
$(document).ready(function () {
    //Disable partof 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 effect speed of your site as there is no render blocking in this js code.

These code can be used in Blogger, WordPress etc.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here