Disable Copy Paste And Mouse Right Click JavaScript, jQuery

Here is the code we can use to Disable Right Mouse Click Using jQuery:



<script type="text/javascript">
$(document).ready(function () {
    //Disable full page
    $("body").on("contextmenu",function(e){
        return false;
    });
     
    //Disable part of page
    $("#id").on("contextmenu",function(e){
        return false;
    });
});
</script>

Disable Cut, Copy, Paste Using jQuery:

<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>

Hope this will help!

Comments

Popular posts from this blog

Error: The client and server cannot communicate, because they do not possess a common algorithm.

How to split comma separated string into rows in mysql?