Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 775951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:22:24+00:00 2026-05-14T19:22:24+00:00

I just can’t get this thing. How is ZeroClipboard supposed to work? Why does

  • 0

I just can’t get this thing. How is ZeroClipboard supposed to work? Why does it need to move the flash-element over the copied text?

I’ve read this thing: http://code.google.com/p/zeroclipboard/wiki/Instructions

Can someone provide me a short snippet, which makes it possible to copy a text in variable to users clipboard, when user clicks a link. Is this even possible? I don’t care, if it doesn’t work on all browsers (IE6 for example).

I’m using jQuery.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:22:24+00:00Added an answer on May 14, 2026 at 7:22 pm

    The “minimal example” code given on the page you link to (http://code.google.com/p/zeroclipboard/wiki/Instructions#Minimal_Example) appears to be what you want. I’ve copied it here and altered it to demonstrate putting text into a variable and then copying that text to the clipboard, since that’s what you’re interested in. Note that, in real life, what you’d presumably want to do is call the clip.setText() part within some function, since you might not know, at the point when the page is first loaded, what text you want to copy.

    <html>
    <body>
            <script type="text/javascript" src="ZeroClipboard.js"></script>
    
            <div id="d_clip_button" style="border:1px solid black; padding:20px;">Copy To Clipboard</div>
    
            <script language="JavaScript">
                    var clip = new ZeroClipboard.Client();
                    var myTextToCopy = "Hi, this is the text to copy!";
                    clip.setText( myTextToCopy );
                    clip.glue( 'd_clip_button' );
            </script>
    </body>
    </html>
    

    The flash element doesn’t need to be “over the copied text”; it needs to be “glued” to whatever DOM element you want your user to manipulate — most likely a button to click. The reason is that Javascript doesn’t have access to the clipboard, so you need to use Flash instead. But Flash can only operate on the user’s machine in response to a user’s click — so you “trick” the user into clicking on the Flash by making it an invisible overlay over an HTML element.

    I’ll note that while the particular example of copying to the user’s clipboard is probably benign, this approach troubles me, as it wouldn’t be hard to imagine the hidden flash element doing more malicious thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.