0

My from submission is returning a block of text that i would like sent directly to the system's clipboard. Users are on FF3.6x thx

justSteve
  • 5,174
  • 18
  • 66
  • 131

1 Answers1

0

Hi you can use following function:

function copy_to_clipboard(text)  
  {  
      if(window.clipboardData)  
      {  
      window.clipboardData.setData('text',text);  
      }  
      else  
      {  
          var clipboarddiv=document.getElementById('divclipboardswf');  
      if(clipboarddiv==null)  
      {  
         clipboarddiv=document.createElement('div');  
             clipboarddiv.setAttribute("name", "divclipboardswf");  
         clipboarddiv.setAttribute("id", "divclipboardswf");  
         document.body.appendChild(clipboarddiv);  
      }  
          clipboarddiv.innerHTML='<embed src="clipboard.swf" FlashVars="clipboard='+  
  encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';  
      }  
      alert('The text is copied to your clipboard...');  
      return false;  
  }

Further info: How do I copy to the clipboard in JavaScript?

and thanks to Andreas Grech

Community
  • 1
  • 1
Alex Rashkov
  • 9,125
  • 3
  • 28
  • 57
  • Let me know if I'm missing something, it looks like this approach is pretty much deprecated by Flash 10. GvS poins @GvS for http://code.google.com/p/zeroclipboard/ – justSteve Oct 02 '10 at 17:02