Labels

php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Wednesday, January 24, 2018

JavaScript to Disable Mouse Right Click ,Cut, Copy and Paste Options

If we want to prevent the user from copying content from a web page,
we need to disable right click and also we need to disable the copy, cut,
paste options.

<!DOCTYPE html>

<html lang="en">

<head>

    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

    <!--Javascript code for disable right click-->

    <script>
        $(document).ready(function(){
            $(document).on("contextmenu",function(e){
                return false;
            });
        });
    </script>

    <!--Javascript code for disable cut,copy,paste-->

    <script>
        $(document).ready(function(){
            $(document).on("cut copy paste",function(e){
                return false;
            });
        });
    </script>

</head>

<body>

1. contextmenu (also called contextual, shortcut, and pop up or pop-up menu) is a menu in a graphical user interface (GUI) that appears upon user interaction, such as a right-click mouse operation.

2. The on( ) method attaches one or more event handlers for the selected elements and child elements like cut, copy, paste.

</body>

</html>
                              

6 comments:

  1. I keep listening to the news broadcast talk about getting free online grant applications so I have been looking around for the most excellent site to get one. Could you advise me please, where could i find some? internet marketing

    ReplyDelete
  2. I enjoyed reading your post. I will share it with my other friends as the information is really very useful. Keep sharing your excellent work. Open source php applications

    ReplyDelete
  3. Digital signatures have really improved the security level .To make the documents secure digital signature and encryption is the best way. And temperament is really not easy. Digital Signature Certificate

    ReplyDelete
  4. Thank you so much for providing such a useful content. Digital Signature Certificate

    ReplyDelete
  5. Thanks for the post I actually learned something from it. Class 2 Digital Signature Certificate

    ReplyDelete

More Posts

FOLLOW