0

Javascript finally has the "copy" event and we no longer have to use flash! (well, we still should use flash as a fallback).

http://dev.w3.org/2006/webapi/clipops/#x3.1.1-copy-event

I'm trying to figure out how to: Click on an anchor tag (Copy) and it copies the (text input src /or innerHTML) to the clipboard. Here's a fiddle of the HTML/CSS http://jsfiddle.net/LkUhM/

Can anyone guide me?

:::::HTML:::::

<div>
<ul>
    <li><input type="text" class="input" value="This is the next that will be copied!" /><a href="#" id="copy" class="copy">Copy!</a></li>
    <li><input type="text" class="input" value="This is the next that will be copied!" /><a href="#" id="copy" class="copy">Copy!</a></li>
    <li><input type="text" class="input" value="This is the next that will be copied!" /><a href="#" id="copy" class="copy">Copy!</a></li>
    <li><input type="text" class="input" value="This is the next that will be copied!" /><a href="#" id="copy" class="copy">Copy!</a></li>
</ul>

<textarea></textarea>

1
  • well.. maybe it was just wishful thinking Commented Feb 20, 2013 at 12:12

1 Answer 1

1
  1. You're looking at an old version of that spec. The new one is here: http://www.w3.org/TR/clipboard-apis/
  2. According to the current spec, you cannot programmatically simulate any of these clipboard events. I am trying to work with the appropriate W3C working group to get that changed to at least allow simulation when the user clicks and/or issues a keyboard event (just like how you can get write access to the clipboard with Flash).
Sign up to request clarification or add additional context in comments.

2 Comments

Thankyou. I was in the process of creating a html5 web app (for mobile), and was planning on using the "flash copy/paste" hack...but to my dismay I came to realize that flash in NOT installed on phones..or at least androids. So I've been trying to find a solution ever since and hoping that some form of js solution would be created.
Android: You can install Flash on Android (for now) but Adobe already announced that it will not be supported anymore. Blackberry 10: Flash comes stock on Blackberry 10 OS phones but it is also disabled by default, so you have to go into the browser settings to enable it; I would guess it won't be supported for much longer, though. iOS: You cannot install Flash on iOS (iPhones, iPads, etc.). Windows Phone: You cannot install Flash on Windows Phone (WP7, etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.