After digging a little more, I found that I needed to use a wallpaper. Apparently this is the only thing you can call document.execCommand. Thus, the fix is ββto create background.html with the copy and input function in it, add a listener like this:
chrome.extension.onRequest.addListener(function(obj) { copyLinkToClipboard( obj.link ); });
and then use sendRequest to pass the text you want to copy to the original page:
chrome.extension.sendRequest({link: linkText});
and don't forget to add the background image to the manifest
"background_page": "background.html",
voila. The text is copied to the clipboard. LOVE would be an easier way to do this (if security is a problem, why not make an api for extensions? Or rather, why break an experimental api just to make us make this stupid workaround?), But well, this will be enough for time
source share