How to Disable Copy and Right-Click on Website?

copy block

Good Asked on September 28, 2021 in Website.
Add Comment
  • 1 Answer(s)

    By disabling mouse right-click, you prevent visitors from selecting and copying your content. By using the code below, you can disable mouse right-click in WordPress.

    First, use the following jQuery library:

    <script src=”jquery.min.js”></script>

    Then, add the following codes:

    <script type="text/javascript">
    $(document).ready(function () {
        //to disable the entire page
        $("body").on("contextmenu",function(e){
            return false;
        });
        
        //to disable a section
        $("#id").on("contextmenu",function(e){
            return false;
        });
    });
    </script>

    If you want to disable mouse right-click for a specific section of a web page, you have to use a selector like #id, .class, etc.

    Otherwise, to disable mouse right-click on an entire page, use body selector.

    How to Disable Copy and Paste?

    Disabling cut, copy and paste can also be done for a specific section or an entire web page. By using the following code, you can prevent visitors from copying your content:

    <script type="text/javascript">
    $(document).ready(function () {
        //to disable the entire page 
        $('body').bind('cut copy paste', function (e) {
            e.preventDefault();
        });
        
        //to disable a section
        $('#id').bind('cut copy paste', function (e) {
            e.preventDefault();
        });
    });
    </script>

    How to Disable Copying Hotkeys?

    As you probably know, there a lot of hotkeys in different operating systems that would simplify a process. For example, Ctrl+A to select all in a document, Ctrl+S to save a document, Ctrl+X to cut a selected text, Ctrl+C to copy an item or text, Ctrl+V to paste the copied item or text.

    To disable these hotkeys, use the following code:

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

    Best WordPress Plugins for Disabling Copy and Right-Click

    In another article, we explained how to prevent website images from being copied. However, we would briefly introduce the top plugins to disable copy and right-click function on WordPress.

    1. Content Protector Pro

    The most complete package to protect your website content is Content Protector Pro designed and developed by Better Studio. This plugin comes with a lot of features to protect the content of your website including images, texts, source code, etc.

    Keep in mind, this is a premium plugin. However, by purchasing the Publisher WordPress theme, you get access to this plugin for free. The publisher is available in four packages; the starter package starts at $44 and it goes up to $399.

    1. From WordPress Dashboard click on Publisher.
    2. Choose Plugins.
    3. Search for Content Protector Pack.
    4. Download and activate it.

    Then, hover over Better Studio and click on Content Protector.

    In the configuration tab, click on Text Protection and configure it. Below, we will explain each of them.

    1. This option indicates whether you would like to allow users to copy or not. It comes with three modes, Allow to everyone, Disable for everyone and Allow but append custom text at the end.
    2. This option enables or disables the right-click for users.
    3. The third option allows users to right-click or internal links or not.
    4. This option is self-explanatory, it sends a customized message to those who try to right-click on your website.
    5. The fifth option allows users to select texts or not.
    6. The sixth option allows users to copy or cut texts.
    7. Disables Windows hotkeys.
    8. Disables Mac hotkeys.

    Finally, make sure to click on save changes on the top right corner

    Better Answered on September 28, 2021.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.