[英]Disabling document.execCommand(“copy”) to false
How can I make my selected string to null. 如何将选定的字符串设为null。 So that I am not able to paste.
所以我无法粘贴。 I tried with
document.execCommand('copy') = false;
我尝试使用
document.execCommand('copy') = false;
But it didn't work. 但它没有用。 Can I get any solution?.
我可以得到任何解决方案吗?
You can always rewrite execCommand to ignore copy 您始终可以重写execCommand以忽略副本
document._execCommand = document.execCommand;
document.execCommand = function () {
if (arguments[0] !== 'copy') return document._execCommand.apply(this, arguments);
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.