Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-19-2021, 06:56 PM   #1
avnermoshkovitz
Member
avnermoshkovitz began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2021
Device: Any ereader for Android or iOS
How to view a javascript alert dialog in Calibre

I have an ebook that loads javascript code and it works ok with Calibre.
However, one of the commands is "alert()" and for this command I see the message:
Code:
ERROR: ... Ignored call to 'alert()'. The document is sandboxed, and the 'allow-modals' keyword is not set.
Is it possible to use iframe with attribute sandbox="allow-modal" within the page, e.g.

Code:
cat EPUB/xhtml/raw/ch1.xhtml 
...
<iframe sandbox="allow-modal">
  ...
</iframe>
to show the alert?

Or is the page itself sandboxed, so this will not help?
If the page itself is sandboxed, is there a way to indicate allow-modal to Calibre?

I'm basically trying to get some feedback from an ebook that runs properly in the desktop but does not run ok in mobile, when run via Calibre Content Server.

Thanks,
Avner
avnermoshkovitz is offline   Reply With Quote
Old 07-19-2021, 07:39 PM   #2
avnermoshkovitz
Member
avnermoshkovitz began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2021
Device: Any ereader for Android or iOS
I tried using
https://www.mobileread.com/forums/sh...58&postcount=4
Code:
QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" ebook-viewer
without success.
avnermoshkovitz is offline   Reply With Quote
Old 07-19-2021, 10:26 PM   #3
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: 45,308
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
As I told you in the other thread, the book content is rendered in a sandboxed iframe. There is no way around that. If it were not the case JS in the book would be able to manipulate the library.
kovidgoyal is offline   Reply With Quote
Old Today, 10:35 AM   #4
lcocea
Junior Member
lcocea began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2025
Device: Readium
This is just to say that I agree support for the JavaScript confirmation/alert dialogs would be a very useful feature to have in the calibre Viewer. I particularly like the local storage support in the calibre Viewer. Both features are available in the Apple Books app.
lcocea is offline   Reply With Quote
Old Today, 05:31 PM   #5
lcocea
Junior Member
lcocea began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2025
Device: Readium
...however, the calibre Viewer does not seem to persist the saved values between sessions, which beats the purpose of the localStorage feature.
lcocea is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to view an ebook results in Add Book dialog alleyoopster Calibre 2 08-30-2014 09:07 AM
Comments in Metadata-dialog: Icons in normal view missing, changes in HTML not saved ikarus1969 Calibre 3 11-06-2013 02:40 PM
XML error dialog in code view davidfor Sigil 3 01-30-2012 08:29 AM
Disable Javascript in Book View TheGreatGig Sigil 7 11-21-2011 09:32 AM
Find Dialog and XHTML Code View jondolar Sigil 0 10-18-2011 10:16 AM


All times are GMT -4. The time now is 08:44 PM.


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