iFrame blocks copy to clipboard
Working on a ticket sidebar application and currently have a button that triggers a copy of a link to the clipboard. When run inside the sidebar application we are getting the errror:
"document.requestStorageAccess() may not be called in a sandboxed iframe without allow-storage-access-by-user-activation in its sandbox attribute"
Is there a way to add these sandbox iframe attributes with the manifest.json file or a way around this by using verified urls etc?
-
Hey Luke,
Can you provide a code snippet so we can see how you're trying to accomplish this?
Thanks!
-
Sure thing, I am trying to copy text to the clipboard using this function:
function executeCopy(text) {// create input to insert text intovar input = document.createElement('textarea');document.body.appendChild(input);input.value = text;
// focus and highlight text// input.focus();input.select();
// copy the textdocument.execCommand('Copy');
// remove unneeded input//input.remove();
// notify useralert('Copied to clipboard');} -
Hey Luke,
I haven’t been able to replicate the issue you’re seeing in Google Chrome. After doing a bit of digging, it appears that this is an issue specific to the Firefox browser.
Can you try running the app in Google Chrome and see if everything runs correctly there?
Thanks,
Tipene
Please sign in to leave a comment.
3 Comments