05-01-2021, 01:39 AM | #1 |
Enthusiast
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
|
"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. A direct alternative to this command is not provided, but the new Clipboard API seems to be the way to go. |
05-01-2021, 02:14 AM | #2 |
creator of calibre
Posts: 44,690
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
the new clipboard api only works over https and the viewer already uses it when execcommand fails with an exception, if it is available.
|
05-01-2021, 02:44 AM | #3 |
Enthusiast
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
|
Huh, I am using https, but copying still fails quite often. Should have tried more browsers. Now it seems this only happens in Firefox. Will try to figure out what goes wrong.
|
05-01-2021, 03:09 AM | #4 |
creator of calibre
Posts: 44,690
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
probably when it fails firefox is failing to raise an exception.
|
05-02-2021, 01:06 PM | #5 |
Enthusiast
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
|
Tried to look into the dev tool a bit more. So when an exception is raised (console shows the warning), copying will be successful. However, if console shows no warning, that is when copying becomes flaky. Sometimes it still works without a warning, sometimes it just does not. Interestingly, if I turn on Debugger, for those failed copying actions I get an error: "No permission to write to clipboard". Without Debugger, no error is shown. Again, this only happens in Firefox.
|
05-02-2021, 01:46 PM | #6 |
creator of calibre
Posts: 44,690
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Sounds like a bug in firefox. Either the command should succedd or it should fail and firefox should raise an exception. If it is failing and not raising an exception that is a bug in firefox.
|
05-02-2021, 11:48 PM | #7 |
Enthusiast
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
|
Yeah, I think it is. Just have to wait for Firefox to fix this bug.
|
Tags |
browser, calibre, clipboard, viewer |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to let websites identify kobo browser as "mobile" instead of "PC"? | price | Kobo Reader | 10 | 03-06-2019 06:46 PM |
Browser Viewer: Request to hide <aside epub:type="noteref"> | nqk | Calibre | 7 | 07-11-2018 01:49 AM |
Calibre "Tags" copy to "shelves" | troll05 | Calibre | 5 | 06-21-2015 06:01 AM |
"Copy to Libary (delete after copy)" - Placement Suggestion | plib | Library Management | 8 | 07-17-2012 10:53 PM |
copy to clipboard in browser? | RAH | Nook Color & Nook Tablet | 1 | 04-28-2011 08:37 AM |