How to cut, copy and paste from JavaScript to a custom clipboard

There are several similar questions in stackoverflow that concern how to cut, copy, and paste from JavaScript (in response to a button click, for example), without the user using CTRL + X, C, or V.

All of these answers either assume that you are crazy for wanting to do this, and that users should never have their buffers violated in this way, or use hacking of an invisible Flash movie (which causes 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, select "Paste" (or "Cut" or "Copy"), and DO NOT get a browser window that says: "Your browser’s security settings do not allow the editor to automatically perform copy operations "

However, go to another rich text editor ( CKEditor or TinyMCE , but this is common among everyone) and try the same command. You will receive a message that reads:

"Your browser’s security settings do not allow the editor to automatically perform copy operations."

So the question is simple: what are Google Docs doing to allow users to cut, copy, and paste through a menu button that doesn't work on security issues?

+4
source share
1 answer

A quick look at all my browsers shows that I have the Google Docs extension installed. I know that using the extension you can use the extension (browser extensions in another, more “reliable” sandbox) that you could (and people) use to expose the javascript APIs used in their sites in the browser in which the extension is installed.

, google, " Google" - . - , , , .

Google , - , , Google -, -. , Google .

, : . / Chrome, Firefox, Safari, IE8 +... .. Google - , Google, . (IE, Google Chrome chrome://extensions/, Google).

, Chrome, , ! , , " ".

:

+3

All Articles