0

I have an html Table where I want my users to copy the innerHtml of the table cells into the clipboard. I am aware that the browser is sandboxed and that this is not allowed on many browsers.

I have searched many similar questions on SO and I am aware that my question will be considered a duplicate by many (however I believe that the question is relevant again):

  1. Copy to clipboard using Javascript
  2. How do I copy to the clipboard in JavaScript?
  3. Way to copy to clipboard in the PURE javascript?

The answers to the questions above can be summerized in:

  • In IE is possible to copy an element into the clipboard by using the api like so:

    CopiedTxt = element.createTextRange();
    CopiedTxt.execCommand("Copy");
    
  • It is not possible to do it Cross-Browser without flash.

The reason why I decided to ask the question again is two-fold: 1. The answers and questions are already somewhat old (1-2 years) 2. Google docs manages to copy selected cells in the spreadsheet on Firefox to the clipboard, and without Flash.

So there has to be a way to perform this operation on Firefox and Webkit without the use of Flash. Does anybody have any idea of how the guys at google managed to implement this functionality on their spreadsheet?

Community
  • 1
  • 1
woolagaroo
  • 1,492
  • 2
  • 22
  • 30
  • I just found that soultion: http://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript – user2853437 Oct 07 '13 at 14:14
  • 1
    *"Google docs manages to copy selected cells in the spreadsheet on Firefox to the clipboard, and without Flash."* If you're using the keyboard to do that (Ctrl+C), it's probably Firefox, not Google Docs. In Google Docs, if I try to copy something using a Google Docs pop-up menu, I get a message saying I need to install an extension to do that (whereas using Ctrl+C works, because Chrome does the work rather than Google Docs). – T.J. Crowder Oct 07 '13 at 14:14
  • @user2853437: thanks, but this solution is not really what I am looking for, I would like to copy the selected cells to the clipboard by using ctrl+c or a context menu. – woolagaroo Oct 07 '13 at 14:16
  • Even in gmail, you can paste image from clipboard to mail. Its reverse of what is needed but, again chrome is able to access clipboard to retrieve the image and paste in mail – Anand Oct 07 '13 at 14:16

0 Answers0