View Single Post
Old 05-01-2021, 12:39 AM   #1
georgehuang
Enthusiast
georgehuang began at the beginning.
 
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
Exclamation "Copy to clipboard" does not work reliably in the browser viewer

In the browser viewer, I have tried copying selection with a keyboard shortcut and with selection popup. Both can fail with a successful rate lower than 50%. It usually requires multiple clicks to copy text to the clipboard.

In Firefox's console, I got:
Code:
document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.
With a bit of searching, it appears that "Document.execCommand()" is now deprecated and should be avoided using.

A direct alternative to this command is not provided, but the new Clipboard API seems to be the way to go.
georgehuang is offline   Reply With Quote