ZeroClipboard hosted on CDN

When working with ZeroClipboard, in my local environment it worked perfectly. However, when I uploaded the .swf to Amazon S3 I started receiving an error and the plugin stopped working.

After some googling I found out how to fix this. Here’s the beginning of my code:

var clip = new ZeroClipboard($(".copy"), {
    moviePath: "http://mysite-assets/js/lib/ZeroClipboard.swf",
    trustedDomains: location.host
});

I had to set the trustedDomains with my site url (not the CDN) to enable the Cross-Domain access.

For more info check out the setting options in the ZeroClipboard documentation.

Leave a comment