I previously wrote about a cross browser copy and paste using jQuery.Copy. Everything was fine until flash updated to version 10. It now throws a security warning. Jojo pointed out that were was another plugin using the same concept that avoids this security warning. Enter Zero Clipboard The implementation is simple:
Step 1 - Include ZeroClipboard.js & ZeroClipboard.swf
Include ZeroClipboard.js in your header scripts. After the script, set the path of the ZeroClipboard.swf flash file.
Step 2 - Start using it!
ZeroClipboard allows you to create multiple instances of the clipboard. In most circumstances you will only need one. Instantiate the clipboard and then start using it.
var clip = new ZeroClipboard.Client(); // Copy some text clip.setText("Hello World");
There’s a lot more you can do with this little script and you can find out more from their wiki
Because a lot of people have been commenting about compatibility, here is the compatibility matrix from http://code.google.com/p/zeroclipboard/wiki/Instructions
The Zero Clipboard Library has been tested on the following browsers / platforms:
|Browser||Windows XP SP3||Windows Vista||Mac OS X Leopard|