"Copy to clipboard" button

Thanks for the update @james.campbell, I just came across this and very pleased with the simple solution! Though readers should be aware you’ll get an error when testing the app from the Anvil editor preview if using Google Chrome. I get this error using version 93.0.4577.82:

ExternalError: NotAllowedError: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://goo.gl/EuHzyv for more details.

It works like a charm using the Share app... > Run your app link however, I assume because the editor previews the app using a ‘cross-origin iframe’ as described in the Deprecating Permissions in Cross-Origin Iframes - The Chromium Projects article linked in the error, while the Share app... > Run your app does not.

No problems in Firefox version 92.0.1 in either the Anvil editor preview or a Share app... > Run your app link.

3 Likes