ZeroClipboard: swf loaded, but not working

前端 未结 5 1060
旧时难觅i
旧时难觅i 2021-02-14 05:51

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

相关标签:
5条回答
  • 2021-02-14 06:33

    I solved editing this line on ZeroClipboard.min.js

    return a+"ZeroClipboard.swf"
    

    to:

    return "//YOUR/PATH/TO/ZeroClipboard.swf"
    
    0 讨论(0)
  • 2021-02-14 06:35

    If you extract the project exactly, the .SWF file is located here:

    moviePath: "../zeroclipboard.swf"
    
    0 讨论(0)
  • 2021-02-14 06:39

    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

    0 讨论(0)
  • 2021-02-14 06:39

    Would just like to point out for anybody else who finds this question first: ZeroClipboard does not work when looking at the file locally i.e. file://path/index.html. This is because of Adobe's security policies blocking the file:// protocol.

    https://stackoverflow.com/a/9450359/710377

    If you're already using Node.js at all (even just for the package manager) you can spin up a basic web server on the command line to test ZeroClipboard with npm install http-server -g and http-server /path/ (assuming that npm stuff is already on your path).

    0 讨论(0)
  • 2021-02-14 06:53

    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~

    0 讨论(0)
提交回复
热议问题