Search code examples
javascriptjqueryclipboardzeroclipboard

Copy Clipboard using zeroclipboard


I've a requirement where I need to copy text to Clipboard. So, I've gone through some samples and started using zeroclipboard.

Now, my problem is : The demo which is shown on the home page of http://zeroclipboard.org/ is only working when we are manually clicking the button.
But if we trigger a click event for the button, the text is not getting copied to the clipboard.

Is this possible to get the text copied to Clipboard on button click event?


Solution

  • This is the second paragraph on the zeroclipboard github readme doc

    Limitations

    User Interaction Required

    Due to browser and Flash security restrictions, this clipboard injection can ONLY occur when the user clicks on the invisible Flash movie. A simulated click event from JavaScript will not suffice as this would enable clipboard poisoning.