execCommand("copy") doesn't work.
For right now, the only way to copy a string automatically from within
the extension is to give your extension experimental permissions in
the manifest.
You must also add the command --enable-experimental-extension-apis
flag to chrome.
I ran into this same problem.
Once you've done this, you can do a copy by calling
chrome.experimental.clipboard.executeCopy(int tabId, [function
callback]). That should be called by your background page, not a
content script.
Calling executeCopy will copy the selected text in the tab passed via
tabId. Its basically the same as hitting ctrl+C on that tab, except
this is done programatically.
The only way I know to copy a string to the clipboard is by creating
an input box, filling it with the string to be copied, then passing a
message to background.html, which then executes the copy. The input
box is then removed from the DOM when background.html send a message
back saying that the text was copied to the clipboard successfully.
I usually put the string to be copied in a input box inside an AP div
with dimensions 1px by 1px and opacity of .01. That prevents the user
from noticing the DOM 'jump' when the input box is inserted and
removed.
On Jul 7, 11:39 pm, jastrzebiec <
jackkozlow...@phonedialerpro.com>
wrote: