سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top