Cannot Copy a file in VSCode (in Home Assistant) open in Firefox
On Firefox browser, I cannot Copy a file in Studio Code Server (within Home Assistant). SCS is open in HA in a Firefox tab. I get the error popup "Unable to read from the browser's clipboard. Please make sure you have granted access for this website to read from the clipboard." "Learn More" links to https://code.visualstudio.com/docs/remote/codespaces#_how-do-i-allow-vs-code-to-access-my-clipboard-for-reading and the "How do I allow VS Code to access my clipboard for reading?" section. But I cannot find similar settings in Firefox's Settings menu.
Any suggestions please on how to resolve this? I'm sure I used ~ a year back to be able to Copy a file ok in VSCode on Firefox. Thank you.
Solution choisie
Firefox 127 added support for the clipboard.read() method used in other browsers; I think this was previously restricted to add-ons.
As an example of how it should work: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read#result_2
Firefox 127+ does not present a permission prompt, but there needs to be a direct connection between the user action triggering the clipboard read and the read itself; if there are hoops in between, permission maybe silently denied. https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#security_considerations
Since browsers work differently, it's possible that websites which previously had special handling for Firefox will need to update to specially handle this change. However, I'm just guessing.
I don't know if there is a preference to roll back the Firefox 127 change.
Lire cette réponse dans son contexte 👍 1Toutes les réponses (6)
You should contact their support on how to use their software or how to integrate with Firefox browser since that isn't a Mozilla product.
Hi @markwarner22 The problem is on the Firefox Settings side. As I explained, and provided a link to, VSCS have provided a good indication of what the issue is and (on other browsers) how to solve it. My question was/is how to achieve that on Firefox...
Solution choisie
Firefox 127 added support for the clipboard.read() method used in other browsers; I think this was previously restricted to add-ons.
As an example of how it should work: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read#result_2
Firefox 127+ does not present a permission prompt, but there needs to be a direct connection between the user action triggering the clipboard read and the read itself; if there are hoops in between, permission maybe silently denied. https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#security_considerations
Since browsers work differently, it's possible that websites which previously had special handling for Firefox will need to update to specially handle this change. However, I'm just guessing.
I don't know if there is a preference to roll back the Firefox 127 change.
Hi @jscher2000 , and thank you for your helpful response. However, I'm not sure exactly what you're advising me that I need to do? When I try your "Clipboard_API#security_considerations " test in Firefox (133.0.3 64bit), it responds "Error: Clipboard read operation is not allowed.". Since, I've also found I get the same "cannot copy from clipboard" error in VSC when in MS Edge browser. So, are you saying... a) The problem is on the Firefox side, and there's nothing I can do? b) The problem is on the VSC server side, and I need them to fix it? c) The problem is in Home Assistant, and I need them to update their VSC version or maybe change it's config in HA so it works on Firefox (and Edge)?
Best regards, Ian
IanBJones said
When I try your "Clipboard_API#security_considerations " test in Firefox (133.0.3 64bit), it responds "Error: Clipboard read operation is not allowed.".
Thank you for testing that. When I test in a cleaner (less customized) profile, I noticed there is a Paste button when the copied material originated outside the little test frame (screenshot attached):
If I don't use that Paste button, then I get the error you mentioned. Not sure whether you see that button anywhere on the VS Code site.
Hi @jsher2000, Again, my thanks. When I try your "Clipboard_API#security_considerations " test in HA's Visual Code Server page, I just get the error popup - no Button that I can see anywhere, either in Firefox or Edge browser. Both browsers get the error popup. So, I'm guessing this is one for the HA team to look at...
Many thanks for your help.