0

How can I make my selected string to null. So that I am not able to paste. I tried with document.execCommand('copy') = false; But it didn't work. Can I get any solution?.

nircraft
  • 8,242
  • 5
  • 30
  • 46

1 Answers1

0

You can always rewrite execCommand to ignore copy

document._execCommand = document.execCommand;
document.execCommand = function () {  
  if (arguments[0] !== 'copy') return document._execCommand.apply(this, arguments);
  return false;
}
epascarello
  • 204,599
  • 20
  • 195
  • 236