I'm trying to build a WYSIWYG
, and I've three buttons: copy
, cut
and paste
.
I tried this script for each one of them, but it didn't worked.
This is my script :
//Copy
document.getElementById('copy').addEventListener('click', function(){
document.execCommand('copy', false, null);
}, false);
//Cut
document.getElementById('cut').addEventListener('click', function(){
document.execCommand('cut', false, null);
}, false);
//Paste
document.getElementById('paste').addEventListener('click', function(){
document.execCommand('paste', false, null);
}, false);
In Google chrome
, Internet Explorer 11
, Safari
and Opera
no one of them has worked, and I don't get anything in the console.
In Mozilla Firefox
I get this message :
Error: Permission denied for <file://> to get property Clipboard.cutcopy
document.execCommand('cut', false, null);
The same thing for copy
and paste
.
How can I solve this ?