ZeroClipboard doesn't work and it doesn't throw any errors (javascript console).
The website is hosted on a HTTPS webserver running on localhost. Both the website and the SWF are served over HTTPS by the same server.
The SWF is loaded and positioned correctly over the button (with ID: testButton). When right-clicking on the button, the flash context menu (About Adobe Flash Player 11.7...) is shown.
However, none of the events, not even "load", gets fired.
I am working on this problem for two days months now and i can't find a solution.
Additional info:
Here is my code:
var clip = new ZeroClipboard(document.getElementById("testButton"), {
moviePath: "media/zeroclipboard.swf"
});
clip.on("dataRequested", function(client, args) {
client.setText("Copy me!");
});
clip.on("load", function(client) {
alert("movie is loaded");
});
clip.on("complete", function(client, args) {
alert("Copied text to clipboard: " + args.text);
});
clip.on("mouseover", function(client) {
alert("mouse over");
});
clip.on("mouseout", function(client) {
alert("mouse out");
});
clip.on("mousedown", function(client) {
alert("mouse down");
});
clip.on("mouseup", function(client) {
alert("mouse up");
});
After months I finally found a solution:
ZeroClipboard doesn't work out-of-the-box in CommonJS environments in the browser, even it says it does.
The fix for that is assigning the module scope variable (e.g. ZeroClipboard) to the global window object:
ZeroClipboard = require("zeroclipboard");
window.ZeroClipboard = ZeroClipboard;
I created a bug report on this: https://github.com/zeroclipboard/zeroclipboard/issues/332
I'm not sure if this would help~ but have you tried changing your moviePath a little bit? Like this:
{moviePath:"//YOURSERVER/path/ZeroClipboard.swf"}
I was trying to use ZeroCLipboard in the whole month and most of the time I fail because I got the path wrong in one way or another...
Good luck anyways~
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With