Search code examples
javascriptjqueryhtmlclipboardzeroclipboard

difficulty with zeroClipboard


I am using zeroClipboard but I don't manage to have it working.

Here is my HTML markup:

    <div id= 'd_clip_button'>
        <img class = 'displayed' src="{{ asset('bundles/yopyourownpoet/images/CopyPoemPage8.png') }}" alt="Copy Poem" height="71" width="300" />
    </div>

And the javascript:

        <script src="{{ asset('bundles/yopyourownpoet/js/ZeroClipboard.js') }}" type="text/javascript"></script>
    <script>
        $(document).ready(function() {
            ZeroClipboard.setMoviePath("{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}");
            var clip = new ZeroClipboard.Client();
            clip.setText( "aaaa" );
            clip.glue( 'd_clip_button' );
            clip.addEventListener( 'onLoad', function(){ alert('loaded baby'); } );

        });
    </script>

I see the alert 'loaded baby'. However, I never have the text copied in my clipboard. I tried on local on my computer and on the server as well.

I also went to this page http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html and autorized flash, but still not working.

What could I be doing wrong?


Solution

  • If you are having troubles with zeroClipboard, you might want to give this jquery plugin a try: http://www.steamdev.com/zclip/

    zclip is based on zeroClipboard. Easy to install & easy to use.