Using ZCLIP properly

56 views Asked by At

Hi Im using ZCLIP to copy text to clipboard, it works well in the demo but not on my site, I have this code, only this ZCLIP related code , no other code in the file Im checking now, it triggers before copying function, but failes to copy and not calling aftertrcopy

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.zclip.js"></script>
<a id="copy_link" href="#">Copy now</a>
<script>
$(document).ready(function(){

    $('a#copy_link').zclip({

        path:'ZeroClipboard.swf',
        copy:'Testing zclip',
        beforeCopy:function(){
        alert('going to copy');
        },
        afterCopy:function(){
        alert('copied here');
        }

    });

});
</script>

Any idea why it is not copying it to clipboard?

1

There are 1 answers

0
Mazzu On

Zclip works only on a page which is loaded from a server i.e the URL address should start from http or https.

You might trying to execute zclip from a local file.

Hence, try zclip using local server, hope it will work for you. :)