Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZeroClipboard JavaScript library throws Uncaught Error: Error calling method on NPObject

I am trying to copy content to clipboard using https://github.com/zeroclipboard/ZeroClipboard. It seems a good library, but I am getting the error 'Error calling method on NPObject.' when the copy button (a flash) is hovered.

Seems like a flash security problem, but I am able to load the flash content.

Any ideas?

like image 836
Tukuna Avatar asked Jul 12 '26 10:07

Tukuna


1 Answers

In versions after 1.1.7, if you hosted "ZeroClipboard.swf" on a different domain than the hosting page, you need to set "allowScriptAccess" to "always" other than "sameDomain", also "trustedDomains" should contain current page domain.

ZeroClipboard.setDefaults( { moviePath:'http://YOURSERVER/path/ZeroClipboard.swf',allowScriptAccess: "always",trustedDomains: location.hostname } );
like image 193
BenL3au Avatar answered Jul 15 '26 23:07

BenL3au



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!