How to disable Ctrl C/V using javascript for both internet explorer and firefox browsers

后端 未结 3 517
無奈伤痛
無奈伤痛 2021-01-11 19:32

I am making this javascript code in order to disable Ctlr+c and Ctlr+v, prenscreen, ALT+TAB, Ctlr+S, and PrintScreen keys.





        
相关标签:
3条回答
  • 2021-01-11 19:43
    • I don't like when browsers do this to me, and
    • It's easy to work around, and
    • This doesn't count as "secure" by any definition, but

    Use element.on(?:copy|cut|paste)

    <body oncopy="return false" oncut="return false" onpaste="return false">
    
    0 讨论(0)
  • 2021-01-11 19:46

    you can use it jquery for this. You just need to bind the cut, copy and paste function with your element.

    And add this Jquery script:

    $(document).ready(function() {
        $('#Selector').bind('copy paste', function(e) {
            e.preventDefault();
        });
    });
    
    0 讨论(0)
  • 2021-01-11 20:03

    I am working on React project. We also have the same requirement to prevent copy/paste/right click.

    Use the below code in index.html <body/> tag. This will prevent all unnecessary actions.

    <body oncopy="return false;" oncut="return false;" onpaste="return false;" oncontextmenu="return false;">
    

    Note:Dont forget to vote the answer

    0 讨论(0)
提交回复
热议问题