How to copy text to clipboard?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: How to copy text to clipboard?

  1. #1
    Join Date
    May 2006
    Posts
    306

    How to copy text to clipboard?

    How do I copy text to the clipboard? It's got to be IE and Firefox compatible.
    I also searched on this one, but found a script that only supports IE.

  2. #2
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: How to copy text to clipboard?

    Well, I've found an obscure FireFox work around. http://la.ma.la/misc/js/setclipboard.txt
    Then you could just test which browser you're in, and run the appropriate script...

    But I wouldn't be surprised if there was a simpler solution...
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

  3. #3
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: How to copy text to clipboard?

    There is no way of copying text to the clipboard in Firefox without using Flash or a plugin of some sort. Using JavaScript, you can create a Flash object with the parameters for what you want to copy. Then the Flash object will copy the text to the clipboard. You will need Flash Player installed on all machines that you want to utilize this code.

    http://www.jeffothy.com/weblog/clipboard-copy
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  4. #4
    Join Date
    May 2006
    Posts
    306

    Re: How to copy text to clipboard?

    Well, I'll check out my photobucket because I just remembered they have some sort of "auto-copy" when you click the url of an image you want or IMG code.

    EDIT: Looks like they got a flash object that does the work, eh... maybe I'll try something else, but thanks for the help.
    Last edited by code?; August 2nd, 2008 at 07:26 PM.

  5. #5
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: How to copy text to clipboard?

    Did you not check out the link in my post? The author of that blog shows a JavaScript + Flash solution and even has a link to the SWF necessary.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  6. #6
    Join Date
    May 2006
    Posts
    306

    Re: How to copy text to clipboard?

    Yeah, i did, thanks, but I think there's an easier way to my problem really.

  7. #7
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: How to copy text to clipboard?

    As I already mentioned...

    Quote Originally Posted by PeejAvery
    There is no way of copying text to the clipboard in Firefox without using Flash or a plugin of some sort.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  8. #8
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    566

    Re: How to copy text to clipboard?

    First of all, what do you need this for?
    Would copying the text to a temporal hidden field help?
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that Iím 64-bit and my blanket is 32-bit and I couldnít cover myself with it, so Iíve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  9. #9
    Join Date
    May 2006
    Posts
    306

    Re: How to copy text to clipboard?

    Sorry for not clarifying my post above this one.

    Naw, i think i just wanted to do something better for a site, but I thought of a easier and more suitable solution that didn't require copying text.
    Last edited by code?; August 5th, 2008 at 05:41 PM.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center