Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
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
Old 05-01-2021, 01:14 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,036
Karma: 22669822
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.
kovidgoyal is offline   Reply With Quote
Advert
Old 05-01-2021, 01:44 AM   #3
georgehuang
Enthusiast
georgehuang began at the beginning.
 
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.
georgehuang is offline   Reply With Quote
Old 05-01-2021, 02:09 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,036
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
probably when it fails firefox is failing to raise an exception.
kovidgoyal is offline   Reply With Quote
Old 05-02-2021, 12:06 PM   #5
georgehuang
Enthusiast
georgehuang began at the beginning.
 
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.
georgehuang is offline   Reply With Quote
Advert
Old 05-02-2021, 12:46 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,036
Karma: 22669822
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.
kovidgoyal is offline   Reply With Quote
Old 05-02-2021, 10:48 PM   #7
georgehuang
Enthusiast
georgehuang began at the beginning.
 
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.
georgehuang is offline   Reply With Quote
Reply

Tags
browser, calibre, clipboard, viewer

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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 05:46 PM
Browser Viewer: Request to hide <aside epub:type="noteref"> nqk Calibre 7 07-11-2018 12:49 AM
Calibre "Tags" copy to "shelves" troll05 Calibre 5 06-21-2015 05:01 AM
"Copy to Libary (delete after copy)" - Placement Suggestion plib Library Management 8 07-17-2012 09:53 PM
copy to clipboard in browser? RAH Nook Color & Nook Tablet 1 04-28-2011 07:37 AM


All times are GMT -4. The time now is 03:04 PM.


MobileRead.com is a privately owned, operated and funded community.