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
[FEATURE]: Copy Button doesn't work in HTTP - Use document.execCommand("copy") as fallback #14803
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Currently, the Copy button does not work in http environments because the navigator.clipboard API requires a secure context (https or localhost).
Many opencode users likely run the application in self-hosted http contexts, so this limits usability.
Although document.execCommand("copy") is deprecated, it is still supported by many browsers and works in http enviroments.
I propose implementing execCommand as a fallback when navigator.clipboard is unavalible.
Sample Code
constcontent="copy content";// Check if clipboard API is availableif(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(content);}else{// Fallback for HTTP / older browsersconsttextarea=document.createElement("textarea");textarea.value=content;document.body.appendChild(textarea);textarea.select();document.execCommand("copy");document.body.removeChild(textarea);}
Reacted by Darcy Glennen, condottab and Siyang Tang
I ran into the same issue and it has been bothering me in my daily work, so I tried to submit a PR #17549 to address it.
I'm not very experienced with frontend, so if anyone is interested, I'd really appreciate it if you could take a look.
Activity
Hastyshell commentedon Mar 15, 2026
I ran into the same issue and it has been bothering me in my daily work, so I tried to submit a PR #17549 to address it.
I'm not very experienced with frontend, so if anyone is interested, I'd really appreciate it if you could take a look.
fix(ui): add execCommand fallback for copy button in non-secure HTTP …
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.