You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2021. It is now read-only.
This library is no longer maintained as it is no longer necessary for modern web development. If you want your frontend JavaScript to manipulate the clipboard, please look into the new HTML Clipboard API (various docs available on MDN) or a small convenience wrapper around it like clipboard.js. Thanks for all your support, this project was a labor of love for many years. ❤️
Note:
This master branch contains the v2.x codebase for ZeroClipboard! For the v1.x codebase, see the 1.x-master branch instead.
ZeroClipboard
The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface. The "Zero" signifies that the library is invisible and the user interface is left entirely up to you.
This is achieved by automatically floating the invisible movie on top of a DOM element of your choice. Standard mouse events are even propagated out to your DOM element, so you can still have rollover and mousedown effects.
Suggestions welcome read over the contributing guidelines.
Setup
To setup the project for local development start with these commands in your terminal.
Before submitting a pull request you'll need to validate, build, and test your code. Run the default grunt task in your terminal.
$ grunt
Testing
If you just want to run the tests, run grunt test.
$ grunt test
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.
<html><body><buttonid="copy-button" data-clipboard-text="Copy Me!" title="Click to copy me.">Copy to Clipboard</button><scriptsrc="ZeroClipboard.js"></script><scriptsrc="main.js"></script></body></html>
// main.jsvarclient=newZeroClipboard(document.getElementById("copy-button"));client.on("ready",function(readyEvent){// alert( "ZeroClipboard SWF is ready!" );client.on("aftercopy",function(event){// `this` === `client`// `event.target` === the element that was clickedevent.target.style.display="none";alert("Copied text to clipboard: "+event.data["text/plain"]);});});
This library is fully compatible with Flash Player 11.0.0 and above, which requires
that the clipboard copy operation be initiated by a user click event inside the
Flash movie. This is achieved by automatically floating the invisible movie on top
of a DOM element of your
choice. Standard mouse events are even propagated out to your DOM element, so you
can still have rollover and mousedown effects with just a little extra effort.
ZeroClipboard v2.x is expected to work in IE9+ and all of the evergreen browsers.
Although support for IE7 & IE8 was officially dropped in v2.0.0, it was actually
still technically supported through v2.0.2.