Disable mouse right click, cut, copy, paste functionalities

jQuery
Oct 28 2016
4612 Views

Disable mouse right click, cut, copy, paste functionalities

View demo

Introduction:

In this article, I want you to share my experience during my project. I disabled right click context menu, cut, copy and paste in my project. Jquery provides simple functions to handle this.

Include jquery min file to use this.

Step1: Disable right click context menu

Use bellow jquery snippet to do this.

<script type="text/javascript">

    $(document).ready(function () {

        //Disable full page

        $("body").on("contextmenu",function(e){

            alert("right click functionality is disabled for this page.");

            return false;

        });        

    });

 </script>

Step2: Disable cut, copy and paste

<script type="text/javascript">

    $(document).ready(function () {       

       //Disable cut copy paste

        $('body').bind('cut copy paste', function (e) {

            alert("cut copy paste functionalities are disabled for this page.");

            e.preventDefault();

        });       

    });

 </script>

Leave a Reply