Javascript copy text to clipboard (usually from a form) to work on ALL browsers (ie. Mozilla/Firefox, MSIE, Safari/Konqueror, Opera)

Posted on 2005-05-11
Last Modified: 2008-01-09
Does anyone know of code which can copy the contents of a form for example or some pre-determined text from a js variable to the operating systems clipboard?

It needs to work in all major browsers (see title) under all major operating systems. (ie. Windows, Linux (KDE/Gnome), Mac OS 9/10)
Question by:MarkCC
    LVL 36

    Expert Comment

    Hi MarkCC,

    Usually I would not just link, but even though part of the code is in Dutch, it not only has the common way of doing it for IE, but also one for Mozilla! These are the two major browsers right now. You're not going to get much better. Props to mplungian :)

    Btw, don't just look at the accepted answer. Scroll down a bit until you come to the dutch commented one.

    LVL 1

    Author Comment

    I already have code that works in IE and Mozilla, I however need code that also works in Safari.
    LVL 36

    Expert Comment

    I do not believe it is possible in Safari at the moment, although I am waiting to be corrected (hopefully)
    LVL 17

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

    I will leave the following recommendation for this question in the Cleanup topic area:
        PAQ - No Refund

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Accepted Solution

    PAQed with no points refunded (of 125)

    Community Support Moderator

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Both jQuery and Mootools offer some nice, easy to use scripts. Mootools is best known for their interactive slideshows and jQuery for their menus, but both have many other uses as well.   jQuery is basically a toolkit with many DOM (http://en.wik…
    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now