View Full Version : Copy text area contents to Clipboard?

06-08-2010, 04:23 PM

I've been looking around the web for a simple JavaScript to solve this problem but can't seem to find something that would work both in IE and FF and the other major browsers?

So basically I have a page listing about a dozen badges people can use to link back to me. I have presented the code for each badge (eg. a href, img src, alt...) in a separate textarea and I'd really love to add a link next to each textarea that would say something like "Click here to copy to Clipboard" then it would copy the text from within the corresponding textarea to the Clipboard so as to eliminate the need for Ctrl+A, Ctrl+C.

Thank you in advance people!

06-09-2010, 07:13 PM
Anyone anything?

I've seen a few scripts and they don't look like anything too complicated (OK, I'm not a JS programmer so I can't know for sure)... I just need something that would work with both FF, IE and the other browsers maybe. If only I could remember a site that does this...

rnd me
06-09-2010, 08:59 PM
the actual clickable buttons have to be made in flash, browsers don't like scripts accessing the clipboard. You can find IE code, bu the minor convenience of saving two clicks is negated by the three clicks of dismissing IE's script warning... put an onfocus="this.select()" on the textarea to save the users one of those clicks.

you can find my old clipboard script in the "post a javascript" section, but flash 10 broke it for non IE browsers...