Copy & Paste JavaScript Codes for popular browse like IE,Firefox and opera etc

Applications-Folder-48x48 Copy & Paste JavaScript Codes for pop browse like IE,Firefox and opera etcThe function belows that can copy & paste text contents for pop browselike IE,Firefox and opera etc.You can download the source from here >>>copyToClipboard.js

copyToClipboard = function(txt) {
if(window.clipboardData) {
  window.clipboardData.setData("Text", txt);
} else if(navigator.userAgent.indexOf("Opera") != -1) {
window.location = txt;
} else if (window.netscape) {
try {"UniversalXPConnect");
} catch (e) {
alert("You need set 'signed.applets.codebase_principal_support=true'
at about:config'");
return false;
var clip =
if (!clip)
var trans =
if (!trans)
var str = new Object();
var len = new Object();
var str =
var copytext = txt; = copytext;
var clipid = Components.interfaces.nsIClipboard;
if (!clip)
return false;
Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

3 Responses to “Copy & Paste JavaScript Codes for popular browse like IE,Firefox and opera etc”

  1. Yuri Cardenas says:

    It would be a good idea if you also post a link where people can find an explanation about the use of the components and classes you’ve got in your code.

    For example:

  2. says:

    @Yuri Cardenas

    Thanks very much!! :)

  3. Cosimo says:

    I don’t understand the opera part (window.location = ‘…’).

    It doesn’t work for me, on Opera 9.6x.
    Is that correct?

Leave a Reply