I am looking to use navigator.clipboard.write & navigator.clipboard.read.
I was having some issues, and I realized that it was not working because the site I was trying it on did not use SSL: It was an http:// site, not an https:// site, and so the API was not activated.
Is there a way to activate this on non SSL pages, and if so, what are the ancillary isues, particularly with regard to security, that this would bring up.
All actions on the addon are user initiated, through the context menu, so there is no way that this addon would paste something to, or copy something from a page, without user actions.
As far as I understand, as long as you have the related clipboard permissions and are calling the functions in your extension contexts and not in a page context they should work just fine.
It pasts a string (“blblblblblbl”) over a selection, but it only works on a page with SSL.
Code from the content script below:
console.log("Current contents of clipboard",(await readFromClipboard()));
document.execCommand('cut'); //copy to clipboard
let copsel = await readFromClipboard();
console.log("selection copied to clipboard", copsel);
await navigator.clipboard.writeText('blblblblblblblblblblblblblbl'); // this is what appears not to be activating
document.execCommand('paste');