I'm creating a functionality to copy text from textarea to clipboard. I'm using zClip jquery plugin, based on Zero Clipboard. I have Laravel 4 project, and I have ZeroClipboard.swf in 'public/js/ZeroClipboard.swf', and trying to add copy to clipboard functionality in view file, which is in 'app/views'. I have this code:
$('#copy_btn').zclip({
path:'ZeroClipboard.swf',
copy:$('#textarea').text()
});
Browser console sais that GET http://mysite.dev/sites/1/ZeroClipboard.swf 404 (Not Found)
. The URL 'http://mysite.dev/sites/1/' is a route to view file i'm loading, and there is no ZeroClipboard.swf file there, it is just route. And thats why 'ZeroClipboard.swf' is not found. So how to specify correct path in the code above?
You can use
ZeroClipboard.config( { swfPath: "http://YOURSERVER/path/ZeroClipboard.swf" } );
As Documented here