ZeroClipboard just isn't working

12,062

Solution 1

What I've just found out:

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"} );
Share:
12,062
mythofechelon
Author by

mythofechelon

Updated on June 09, 2022

Comments

  • mythofechelon
    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 the tar.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 as index.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.

  • Jay
    Jay over 11 years
    Make sure the ZeroClipboard.js file is not corrupted or partially loaded, which prevent the ZeroClipboard object from being created. Check the error before the Uncaught ReferenceError: ZeroClipboard is not defined.
  • mythofechelon
    mythofechelon over 11 years
    Nope. ZeroClipboard.js is fully loaded.
  • rabbit.aaron
    rabbit.aaron over 8 years
    <script>tags will immediately load, unless async is specified, proof here: plnkr.co/edit/cobzT4kvEMfBgDeCggNC