2

I am trying to figure out how to use ZeroClipboard to make a little browser app to copy common strings I use with a simple mouse click. I am quite new to HTML/CSS/JS so before trying to apply ZeroClipboard to my own project, I wanted to get it running using the example code provided at the zClip site. On many of the ZeroClipboard questions I've seen here, respondents have directed questioners to the developer's example. The example seems straightforward, but I can't seem to replicate it. Here is what I have (Note: deleted the part from the example that dealt with dynamic text because a) I just wanted to get the basics down and b)my project is only concerned with static text):

<!doctype html>
<html>
<head>
    <title>Demo</title>
</head>
<body>

<!--text begin-->
<p id="description">TESTING</p>
<br>
<a href="#" id="copy-description" class="">Click here to copy the above text</a>
<!--text end-->

<!--scripts begin-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>

<script type="text/javascript" src="js/jquery.zclip.min.js"></script>

<script type="text/javascript">
    $(document).ready(function(){

        $('a#copy-description').zclip({
            path:'js/ZeroClipboard.swf',
            copy:$('p#description').text()
        });
    });
</script>
<!--scripts end-->

</body>
</html>

I have viewed the page source as well and just can't seem to see where mine is different. Any input would be greatly appreciated. Apologies if a similar question has been asked. I did not see one, though.

maptastik
  • 135
  • 1
  • 6

1 Answers1

10

I had the same problem as you, replicate examples, etc. Then I figured out that Zclip won't work on localhost. To be able to zclip work, you need to make your app live(online).Browsers usually prevent flash from running locally.

Lian
  • 1,597
  • 3
  • 17
  • 30
  • That did it. Kind of a bummer as I wanted to run my little browser app on localhost, but this is still super helpful. – maptastik Jan 06 '14 at 04:02
  • I don't know others, but IE can set to run scripts and others also on localhost, like flash. Also you can being advertised about script failed using `` on your code. – m3nda Nov 30 '14 at 20:20