The async clipboard API is a powerful web API, capable of both writing arbitrary data to the clipboard, as well as reading from the system clipboard. As such, there are serious security ramifications when allowing pages to write data to the clipboard
The API is limited to secure contexts, which means that navigator.clipboard is not present for http:// websites.
Workaround (Google Chrome)
Allow-list your particular URL in Google Chrome via chrome://flags/#unsafely-treat-insecure-origin-as-secure in the Insecure origins treated as secure field.
Results in
TypeError: undefined is not an object (evaluating 'navigator.clipboard.writeText')
in JavaScript console.Explanation
This will work correctly over eg
https://gist.homelab:6157
orhttp://localhost
but not eghttp://192.168.1.100:6157
orhttp://gist.homelab:6157
See https://webkit.org/blog/10855/async-clipboard-api/ which states —
Workaround (Google Chrome)
chrome://flags/#unsafely-treat-insecure-origin-as-secure
in the Insecure origins treated as secure field.http://gist.homelab:6157
via Chrome