1

Is there a way through HTML/JavaScript to copy a line of text for the user? So user selects a button and then text is copied, all he has to do now is go and paste it somewhere.

Brad
  • 159,648
  • 54
  • 349
  • 530
Bagzli
  • 6,254
  • 17
  • 80
  • 163
  • Please have a look at [this](http://stackoverflow.com/questions/7713182/copy-to-clipboard-for-all-browsers-using-javascript) post: – Ankit Zalani Jun 21 '13 at 18:22

2 Answers2

3

You could use this library to manipulate the clipboard

https://github.com/zeroclipboard/ZeroClipboard

Stephan
  • 16,509
  • 7
  • 35
  • 61
-2

Can't do it with HTML or JavaScript. You'd have to use a flash or java component to copy the data to the clipboard. The reasons this is disabled is for security purposes.

An example of a flash powered method is this one.

Kat
  • 4,645
  • 4
  • 29
  • 81
  • 2
    It *can* be done with JavaScript, it's just not the most reliable way to do so. – hexacyanide Jun 21 '13 at 18:25
  • It's disabled in most browsers. I'd consider that as not being able to do it. – Kat Jun 21 '13 at 18:26
  • its still not a correct answer, I found a way to do it in the Internet Explorer, however it does not carry over to other browsers. Apparently other browser use different code to achieve this. – Bagzli Jun 24 '13 at 13:31