GM_setClipboard error
WhiteSevs opened this issue · comments
WhiteSev commented
ChromeXt/app/src/main/assets/GM.js
Lines 148 to 161 in aba8e9d
有些时候使用
navigator.clipboard.write
会出现DOMException: Write permission denied.
错误导致无法写入剪贴板。建议:对它加上
catch
,失败的话使用再进行第二种方式document.execCommand("copy")
JingMatrix commented
Actually, no evidence suggests that document.execCommand("copy")
could do a better job than navigator.clipboard.write
.
If this error is not reproducible in a definite way, then I think the best solution for the UserScipt is to catch the error and call GM_setClipboard
again.
It would be great if you can find a way to reproduce it, so that we know what goes wrong.
WhiteSev commented
复制22222222
使用的是ChromeXt
的API,未成功复制,复制444444444
使用的是我自己的API,成功复制