I've been reading several articles saying it was not possible to copy from html5 to clipboard. Yet, I can see that it works perfectly fine from a google spreadsheet. How do they do it? Is there really a flash object under the hood?
Asked
Active
Viewed 881 times
0
-
possible duplicate of [javascript cut/copy/paste to clipboard: how did Google solve it?](http://stackoverflow.com/questions/9658282/javascript-cut-copy-paste-to-clipboard-how-did-google-solve-it) – edeboursetty Sep 26 '13 at 20:41
1 Answers
0
The google uses a very simple but cool method. By using firebug you will get to know that the html code which is loaded has a text area in begining of size 1. What google doc does is that when user selects text and presses ctrl+c, it captures the event and by some technique gets the text which is selected in the doc container and sets the value of text area to that content. Than it focuses and selects the text area. Now it releases the ctrl+c event. But now the text is selected in text area so when the event is realeased the browser copies the text in text area and thus we get the copied text

coder hacker
- 4,819
- 1
- 25
- 50