7

Possible Duplicate:
Copy to clipboard without Flash

I want to copy some text from an element by a given id to clipboard. I want to be flashless solution, no Flash at all. It can be in jQuery or JavaScript.

The solution for IE is simple (clipboardData), but for FF, Chrome and others - it doesn't work.

Help.

Community
  • 1
  • 1
pinus.acer
  • 962
  • 1
  • 9
  • 28

1 Answers1

12

There is no javascript method to do this - its prevented by browser security ... Flash is the best alternative ...

Explanation of security policy on Firefox -> http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard

Manse
  • 37,765
  • 10
  • 83
  • 108
  • 19
    this is garbage... how does chrome say "this is a security problem so we won't implement it, but we will bundle flash with our browser which allows it to happen anyways" – fringd Oct 24 '12 at 21:28
  • 3
    This is false. The Clipboard API is a work in progress standard, being currently implemented by Firefox with the other browsers pending - http://dev.w3.org/2006/webapi/clipops/clipops.html#widl-ClipboardEvent-clipboardData – Alexandru Nedelcu Jan 02 '15 at 21:46
  • 1
    Clipboard API now works in Chrome and Firefox (but not Safari AFAIK) - example here: http://codepen.io/nottrobin/pen/meObWe – Robin Winslow Sep 25 '15 at 14:28