![]() |
#1 |
Member
![]() Posts: 22
Karma: 10
Join Date: Jun 2021
Device: Any ereader for Android or iOS
|
Calibre in mobile
Hi,
I'm new to ebook world, and calibre, so excuse me for the beginner and naieve questions. I have a html5+javascript+css code that I want to run in mobile (Android). Typically this kind of code is run with:
Using a local webserver is possible, but not straight-forward:
I recently discovered that the epub format supports html5+javascript+css which theoretically means (if I understand correctly) that the ebook/epub platform can be used to run typical web code without a web server. So I wrapped my html5+javascript+css code into a file in epub format, and was pleasantly surprised that Calibre on desktop (Ubuntu 20.04) opened the ebook and "read" my code properly. I'm placing "read" in quotation marks because this is not a typical book with mostly text, but some javascript that displays images. Because I want to read the ebook in mobile, I followed the path to use the Calibre Content Server. I started with Calibre Content Server on the desktop (by using e.g. http://localhost:8080), and also tested with Calibre Content Server on mobile (by using e.g. http://192.168.1.75:8080) According to the the documentation Calibre Content Server is expected to work similar to Calibre, but I did find that I had to make some adjustments. Here are 2 examples: Example1 - seeing a button icon image I have a button with an icon. In regular (non-ebook) web code, the icon image is fetched from the webserver via e.g. http://localhost/static/img1.png But for the Calibre Content Server, I need to provide the image via data URI, which reduces the flexibility of the code. Example2 - interaction with a button When the ebook is viewed by Calibre, the button responds properly, i.e. clicking on a button opens a input file dialog. This also works in Calibre Content Server on the desktop. But when using Calibre Content Server on the mobile, the buttons do not respond. I assume that the differences in behaviour are because Calibre Content Server uses the web browser (e.g. Chrome) and the lack of a webserver, which adds restrictions such as:
So I have a general question: is it possible to implement Calibre as a mobile app? I'm sure this can be a big task. I looked at the calibre code and it's huge. I also see the span of the project in years, and the amount of ongoing activity (commits, releases, etc...) My question is more about the technical limit. I basically want to understand what are the limits of ebook/epub to execute html5+javascript+css offline, without many limitations (assuming that requests to external resources are eliminated). Thank you Avner |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There are no limitations, the in browser viewer uses the same code as the desktop viewer and they both run in browsers. The only difference is the in browser viewer loads resources from indexeddb so that means trying to load things dynamically via javascript is not going to work.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 22
Karma: 10
Join Date: Jun 2021
Device: Any ereader for Android or iOS
|
Apparently, the mobile in-browser viewer (via Calibre Content Server) is not the same as the desktop in-browser viewer.
The desktop responds to mouse events, but the mobile does not respond to touch events. The touch events are recognized by other mobile ereaders, so clearly there is something in Calibre or Calibre Content Server that is problematic. I described the problem, and attached a small video clip and a small ebook that demonstrates the problem in https://www.mobileread.com/forums/sh...5&postcount=15 @kovidgoyal, can you please take a look there and confirm my observation? Thanks Avner Last edited by avnermoshkovitz; 07-19-2021 at 05:35 PM. |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Touch events are used for the viewers own UI. And they wont work in either the desktop or the mobile. Mouse events will work in both.
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You seem to be trying to create an application, not a book, I suggest you do that. Use a website or a mobile application, not an ebook.
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre Mobile View | rlefranc | Server | 5 | 06-30-2021 08:21 AM |
Calibre Mobile for iPad | The Old Man | Apple Devices | 11 | 10-02-2017 05:38 AM |
Is there a Calibre app for Mobile ? | shubhs2012 | Calibre | 2 | 08-09-2015 08:26 PM |
Calibre for Linux Mobile | rz123 | Calibre | 1 | 10-05-2009 11:09 AM |
Calibre on Windows Mobile | earthq | Calibre | 5 | 09-25-2009 06:47 AM |