admin管理员组文章数量:1361960
I've developed a Firefox Addon which has a feature of copying some text automatically when the popup window is open. This works fine on Chrome, but it doesn't work in Firefox, and gives me this error message.
uncaught (in promise) DOMException: clipboard write was blocked due to lack of user activation.
I use the clipboard API to do this.
navigator.clipboard.writeText(data).then(()=>{
console.log('copied')
})
Any thoughts to bypass this or fix this?
I've developed a Firefox Addon which has a feature of copying some text automatically when the popup window is open. This works fine on Chrome, but it doesn't work in Firefox, and gives me this error message.
uncaught (in promise) DOMException: clipboard write was blocked due to lack of user activation.
I use the clipboard API to do this.
navigator.clipboard.writeText(data).then(()=>{
console.log('copied')
})
Any thoughts to bypass this or fix this?
Share Improve this question edited Nov 23, 2022 at 19:03 pbarney 2,8834 gold badges39 silver badges53 bronze badges asked Sep 23, 2021 at 17:53 ChethiyaKDChethiyaKD 9283 gold badges9 silver badges19 bronze badges1 Answer
Reset to default 7You extensions needs to have the clipboardWrite
permission to write to the clipboard without user interaction. https://developer.mozilla/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#clipboard_access
本文标签: javascriptHow to copy to clipboard on Firefox addon popup scriptStack Overflow
版权声明:本文标题:javascript - How to copy to clipboard on Firefox addon popup script? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743861513a2551823.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论