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?.
Asked
Active
Viewed 230 times
0

nircraft
- 8,242
- 5
- 30
- 46

Santhosha Acharya
- 33
- 5
-
Unable to understand! – Prashant Pimpale Jun 21 '19 at 13:24
-
how to make document.execCommand('copy') returns false? – Santhosha Acharya Jun 21 '19 at 13:25
-
If you run this `console.log(document.execCommand('copy'));` is showing `false`! – Prashant Pimpale Jun 21 '19 at 13:31
-
1Related: https://stackoverflow.com/q/21743267/6027891 – Ace Jun 21 '19 at 14:12
1 Answers
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