microsoft / vscode-livepreview

Hosts a local server in your workspace for you to preview your webpages.
http://aka.ms/live-preview
MIT License
438 stars 63 forks source link

navigator.clipboard api not working when previewing within vscode #374

Open lcvriend opened 2 years ago

lcvriend commented 2 years ago

Thank you for this very useful extension. It is easy to use and has been working smoothly for me. However, I have run into an issue when previewing a page within vscode that uses the navigator.clipboard API. See the following console message:

index.html:1 Uncaught (in promise) DOMException: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://goo.gl/EuHzyv for more details.

If I open the page in the browser using livepreview then the navigator.clipboard API actually works without problems. It would however be very useful to me if I could use the clipboard API when viewing a page within vscode itself. Is this possible?

saviorand commented 6 months ago

@andreamah this would be helpful for me as well. Is there no way to disable this from the settings?

saviorand commented 6 months ago

Seems related to this? https://github.com/microsoft/vscode/issues/182011

saviorand commented 6 months ago

Might be macOS specific based on https://github.com/microsoft/vscode/issues/129178

andreamah commented 6 months ago

Seems like it might be linked. My best guess is that this is related to upstream, as I don't any explicit settings that particularly target this API.

janosh commented 4 months ago

same issue, also on macOS. if anyone has a fix/workaround, please share