I found several articles saying that this type of action with JavaScript is something "risky" and many browsers prevent this from being done. Also, in the articles I read, they said the only way to do something similar is by using Flash.
So I went to Google for solutions and found the ZeroClipboard , but I was not able to use it. I tried it as follows:
$(document).ready(function(){
var client = new ZeroClipboard( $('button') );
client.swfPath = 'ZeroClipboard.swf'; // está na pasta do projeto
$('button').on('click', function(){
client.setData("text/plain", "TESTE");
});
});
What's wrong?
The button loses the hover effect, the flash is catching it normally. But when I click the button, the string "TEST" is not copied to the clipboard .
No error is displayed on the console.
Ultimately: Is there any other way to do this? Other plugins ?