I have a problem with my extension. I want to paste data from the clipboard.
So far, I\'ve got this:
function
There used to be an experimental clipboard API in Chrome, but this was removed in Chrome 13.
Chrome has moved towards the more standard document.execCommand('paste')
, document.execCommand('copy')
and document.execCommand('cut')
commands: https://developer.mozilla.org/en/Rich-Text_Editing_in_Mozilla#Executing%5FCommands
In Chrome you'll need permissions need to be added to your manifest: "clipboardRead" and "clipboardWrite". http://developer.chrome.com/extensions/declare_permissions.html
Up until Chrome 38, these clipboard permissions were only available to extension pages such as background scripts. As of Chrome 39, content scripts can also use these clipboard APIs after declaring the clipboard permissions in the manifest file (crbug.com/395376).