ZeroClipboard just isn't working
Solution 1
What I've just found out:
- I've downloaded the ZIP with the JS/SWF from GitHub.
- I've looked into the examples from Google Code.
That didn't match. I've got a similar error than the original poster of this question.
After I used the example from GitHub I've succeeded.
Conclusion:
Either use both the example and download from Google Code or (which I would prefer), both the example and download from GitHub.
Solution 2
you will need to specify the path to the swf file :
var clip = new ZeroClipboard( document.getElementById('d_clip_button'),{moviePath: "/path/ZeroClipboard.swf"} );
mythofechelon
Updated on June 09, 2022Comments
-
mythofechelon almost 2 years
Originally, this post was regarding my attempts to inject ZeroClipboard into web pages by and for use by my Chrome extension, but I've dumbed the scenario down and down and down in a seemingly futile attempt to identify the issue and I still can't get it to work.
I'm even having difficulty getting the actual, documented "Minimal Example" on ZeroClipboard's own GitHub to work (admittedly, I've modded the source to actually be HTML5-valid, but the exact original didn't work either). Even
test.html
, which is included in thetar.gz
archive, doesn't work!"Minimal Example": Code
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <input type="button" id="d_clip_button" data-clipboard-text="Copy Me!" value="Copy To Clipboard" /> <script src="ZeroClipboard.js"></script> <script> var clip = new ZeroClipboard( document.getElementById('d_clip_button') ); </script> </body> </html>
"Minimal Example": Console Output
Uncaught TypeError: object is not a function index.html:11
Info
- The entire contents of the
zeroclipboard-1.0.7.tar.gz
archive are in the same directory asindex.html
. - The
ZeroClipboard.js
file isn't corrupted / incomplete and is being loaded correctly. - I'm using Chrome v24.0.1312.52
Either I'm missing something really, really obvious here or ZeroClipboard's documentation / functionality is abysmal.
- The entire contents of the
-
Jay over 11 yearsMake sure the
ZeroClipboard.js
file is not corrupted or partially loaded, which prevent theZeroClipboard
object from being created. Check the error before theUncaught ReferenceError: ZeroClipboard is not defined
. -
mythofechelon over 11 yearsNope.
ZeroClipboard.js
is fully loaded. -
rabbit.aaron over 8 years<script>tags will immediately load, unless async is specified, proof here: plnkr.co/edit/cobzT4kvEMfBgDeCggNC