Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    57
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Copy text area contents to Clipboard?

    Hello,

    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!

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    57
    Thanks
    11
    Thanked 0 Times in 0 Posts
    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...

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,302
    Thanks
    10
    Thanked 586 Times in 567 Posts
    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...
    Last edited by rnd me; 06-09-2010 at 08:01 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • Users who have thanked rnd me for this post:

    electrify77 (06-10-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •