I am making this javascript code in order to disable Ctlr+c and Ctlr+v, prenscreen, ALT+TAB, Ctlr+S, and PrintScreen keys.
Use element.on(?:
copy|cut|paste)
<body oncopy="return false" oncut="return false" onpaste="return false">
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();
});
});
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