You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clipboard APIs do not work inside iframes in webviews #182642
bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunitieswebviewWebview issues
In the hosted page, try to use the clipboard APIs:
<button onclick="window.navigator.clipboard.writeText('inner');">Copy "inner" to clipboard</button>
When clicking the button, the operation will fail and the developer tools will report:
Uncaught (in promise) DOMException: Write permission denied.
I've tried numerous combinations of things in the allow attribute (such as clipboard and clipboard-write http://127.0.0.1:8000/), but nothing seems to fix this. I presume the iframe being another origin is complicating things.
However, outside of VS Code this works fine. I made iframes nested three-deep that cross origins, and as long as I have allow="clipboard-write" then all of the nested frames are able to call this API successfully.
This might be related to #129178 (which is that the system-level Cmd+C shortcut does not work), but I'm not sure these two things should be the same (one is the system copying something, and the other is JavaScript access to the clipboard API) so am raising a separate issue.
Reacted by Danny Tuppeny, Daniel Chevalier, Brian Wilkerson, Ben Konyi, Kenzie Davisson, stevemessick, Jacob Richman, khal, Ayyoub-Essadeq, Hans and 15 more
bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunitieswebviewWebview issues
Activity
nateshmbhat commentedon Nov 9, 2024
any update on this ? please check this issue
fix: 修复 webview 内复制失效——宿主剪贴板桥 + 回复级一键复制(bump 0.11.0)
fix: 面板内复制按钮经宿主剪贴板中继恢复可用(v1.1.1,Issue Vithrive#28)