lundi 1 décembre 2014

How to Cut, Copy and Paste from JavaScript to a User's Clipboard


There are multiple similar questions in stackoverflow which deal with how to Cut, Copy, and Paste from JavaScript (in response to a button press, for instance) without the user having to use CTRL+X, C, or V.


All these answers suggest either that you are insane for wanting to do this and that users should never have their clipboards violated in such a profane manner, or to use the hack of an invisible Flash movie (which has questionable support).


However, Google Docs does this, and does not use a Flash movie. You can open a Google Document, Go to the Edit menu, choose "Paste" (or Cut or Copy) and NOT get a browser window that tells you "Your browser security settings don't permit the editor to automatically execute copying operations."


However, go to another rich text editor (CKEditor or TinyMCE for instance, but this is common among them all) and try that same command. You will get a message that reads:


"Your browser security settings don't permit the editor to automatically execute copying operations."


So the question is simply: What is Google Docs doing to allow users to Cut, Copy, and Paste via a menu button that doesn't run in to security issues?





Aucun commentaire:

Enregistrer un commentaire