You are not logged in.

#1 2019-02-28 15:44:47

stefano
Member
Registered: 2011-04-09
Posts: 287

epub reader supporting javascript?

I am looking for an epub reader supporting javascript, but I can't find any reference to any.

The book I'm interested in contains interactive diagrams: the user can click on them to uncover new parts, and so on. Otherwise the diagrams  just show up as illlustrations.

The reader included in Calibre does not support this functionality.

Suggestions?

Offline

#2 2019-03-01 13:18:56

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,404

Re: epub reader supporting javascript?

What does the file command output about the ebook-file type ?

Okular has optional dependecies that allow it to show many ebook formats, have you tried that ?

Last edited by Lone_Wolf (2019-03-01 13:19:13)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2019-03-01 15:17:10

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: epub reader supporting javascript?

Lone_Wolf wrote:

What does the file command output about the ebook-file type ?

I am not sure why you think the file command would be relevant. It just says "epub document"

Lone_Wolf wrote:

Okular has optional dependencies that allow it to show many ebook formats, have you tried that ?

I hadn't, thanks for the suggestion. Unfortunately, Okular cannot open the file (it tries and fails with an error message), even though I have all of its optional dependencies installed.

There may problems with the file---it is a sample/demo from an e-book publishing house that is Mac-oriented. I intended to provide some feedback on the Linux situation for their product, but I seem to have run out of options.

For what is worth, here is Okular's  console output:

$> okular sg0061_bs_btp1_sample.epub 
libepub (II):   opening 'sg0061_bs_btp1_sample.epub'
libepub (II):   building ocf struct
libepub (II):   looking for mime type
libepub (II):   mimetype found application/epub+zip
libepub (II):   parsing container file META-INF/container.xml
libepub (II):   Found containerr
libepub (II):   Found rootfiles
libepub (II):   found root in OPS/book.opf media-type is application/oebps-package+xml
libepub (II):   Found rootfiles
libepub (II):   Found containerr
libepub (II):   data path is OPS/
libepub (II):   building opf struct
libepub (II):   parsing metadata
libepub (II):   title is Black to Play!
libepub (II):   identifier pub-id((null)) is: urn:uuid:9C83144D-9BC5-4A6E-8830-71d3491dd90c
libepub (II):   creator - (null): Gunnar Dickfeld ((null))
libepub (II):   meta is (null): (null)
libepub (II):   language is en
libepub (II):   date of (null): 2019-02-24
libepub (II):   meta is (null): (null)
libepub (II):   meta is cover: sg0061_bs_btp1_cover.jpg
libepub (II):   parsing manifest
libepub (II):   manifest item nav href navigation.xhtml media-type application/xhtml+xml
libepub (II):   manifest item coverPage href coverPage.xhtml media-type application/xhtml+xml
libepub (II):   manifest item copyrightPage href copyrightPage.xhtml media-type application/xhtml+xml
libepub (II):   manifest item preface href preface.xhtml media-type application/xhtml+xml
libepub (II):   manifest item contents href contents.xhtml media-type application/xhtml+xml
libepub (II):   manifest item ch1 href ch1.xhtml media-type application/xhtml+xml
libepub (II):   manifest item ch2 href ch2.xhtml media-type application/xhtml+xml
libepub (II):   manifest item prob1 href prob1.xhtml media-type application/xhtml+xml
libepub (II):   manifest item prob2 href prob2.xhtml media-type application/xhtml+xml
libepub (II):   manifest item prob14 href prob14.xhtml media-type application/xhtml+xml
libepub (II):   manifest item prob42 href prob42.xhtml media-type application/xhtml+xml
libepub (II):   manifest item prob94 href prob94.xhtml media-type application/xhtml+xml
libepub (II):   manifest item brettstein href brettstein.xhtml media-type application/xhtml+xml
libepub (II):   manifest item buy href buy.xhtml media-type application/xhtml+xml
libepub (II):   manifest item about href about.xhtml media-type application/xhtml+xml
libepub (II):   manifest item coverImageContainer href epubcover.xhtml media-type application/xhtml+xml
libepub (II):   manifest item sg0061_bs_btp1_cover.jpg href img/sg0061_bs_btp1_cover.jpg media-type image/jpeg
libepub (II):   manifest item stylesheet href css/style.css media-type text/css
libepub (II):   manifest item gobooksjs href js/gobooks.js media-type text/javascript
libepub (II):   parsing spine
libepub (WW):   toc not found (-)
libepub (II):   found item coverPage
libepub (II):   found item copyrightPage
libepub (II):   found item preface
libepub (II):   found item contents
libepub (II):   found item ch1
libepub (II):   found item ch2
libepub (II):   found item prob1
libepub (II):   found item prob2
libepub (II):   found item prob14
libepub (II):   found item prob42
libepub (II):   found item prob94
libepub (II):   found item brettstein
libepub (II):   found item buy
libepub (II):   found item about
libepub (II):   parsing guides
libepub (II):   guide item: Cover href: epubcover.xhtml type: cover

Offline

#4 2019-03-01 16:06:25

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,404

Re: epub reader supporting javascript?

I was hoping the file command would give some more info , like EPUB version.
The okular output does show the file looks like a website and uses xml/xhtml which is consistent with the epub format afaik.

https://itsfoss.com/best-ebook-readers-linux/ has a list from july 2018.
Calibre and okular have been tried, FBReader and Bookworm are in repos, the other mentioned ones I don't know.

Another option would be gnome-documents (appears to be gnome default document viewer and does have epub support) .

If none of those are able to open the file correctly , it may be worth it to check on other OSes (windows 10 , android) to verify whether linux programs lack functionality or the file uses apple specific stuff.

Last edited by Lone_Wolf (2019-03-01 16:06:55)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2019-03-01 16:18:09

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: epub reader supporting javascript?

You could try lector as well. It looks interesting, but I haven't tried it yet. https://aur.archlinux.org/packages/lector-git/ Doesn't render in a webview, but a limited qt markup element.

Edit: There is readium as well. An epub reader is HTML based anyways, so electron doesn't feel out of place here. https://github.com/readium/readium-desktop

Last edited by progandy (2019-03-01 16:24:40)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#6 2019-03-01 16:21:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,789

Re: epub reader supporting javascript?

iirc ECMA support requires epub v3 and is oc. a major security concern. I assume many epub readers will disable ECMA in their web component not have to worry about that.
http://lucidor.org/lucifox/ might probably have supported that, but doesn't work w/ modern FF versions.

epubs are just archives w/ a bunch of html files - you could extract them and read them in your browser. Maybe you've to adjust some file paths.

Offline

#7 2019-03-01 17:03:53

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: epub reader supporting javascript?

Lone_Wolf wrote:

If none of those are able to open the file correctly , it may be worth it to check on other OSes (windows 10 , android) to verify whether linux programs lack functionality or the file uses apple specific stuff.

I checked the file on Mac (Books app) and Android (Gitden). It works fine on both, so it is neither a defective file, nor does it use Apple-specific functions. It really seems to be a standard Epub3 file with enhanced JS stuff.

Offline

#8 2019-03-01 17:08:21

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: epub reader supporting javascript?

seth wrote:

iirc ECMA support requires epub v3 and is oc. a major security concern. I assume many epub readers will disable ECMA in their web component not have to worry about that.

As mentioned in a previous message, readers for Android and Mac do support it. I would speculate iOS and Win would too. Do they have a better security model than Linux? Or they just don't care?

seth wrote:

epubs are just archives w/ a bunch of html files - you could extract them and read them in your browser. Maybe you've to adjust some file paths.


That's not my idea of a good reading experience: Download the file, unzip, adjust paths, test....

I guess the real (cheap) option is getting an Android tablet.

Offline

#9 2019-03-01 17:10:29

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: epub reader supporting javascript?

progandy wrote:

You could try lector as well. It looks interesting, but I haven't tried it yet. https://aur.archlinux.org/packages/lector-git/ Doesn't render in a webview, but a limited qt markup element.

Edit: There is readium as well. An epub reader is HTML based anyways, so electron doesn't feel out of place here. https://github.com/readium/readium-desktop

The Readium Chrome App does not work on my file (and Chrome apps are on their way out anyways). I have't tried the Readium desktop app given the many negative comments I found online ("It's definitely alpha software...", etc.)

Offline

#10 2019-03-01 20:46:41

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: epub reader supporting javascript?

stefano wrote:
Lone_Wolf wrote:

If none of those are able to open the file correctly , it may be worth it to check on other OSes (windows 10 , android) to verify whether linux programs lack functionality or the file uses apple specific stuff.

I checked the file on Mac (Books app) and Android (Gitden). It works fine on both, so it is neither a defective file, nor does it use Apple-specific functions. It really seems to be a standard Epub3 file with enhanced JS stuff.

So it is EPUB3, which is good as EPUB2 definitely wouldn't work, but what is standard about enhanced JS stuff? tongue

It has fairly spotty support anywhere, and many reader applications don't even support EPUB3 in the first place, let alone "interesting" things like dynamic JS-based ebooks. You're generally on firmer ground when it comes to mobile devices, since there are a number of proprietary applications that both let you read these books, and try to sell you them.

I don't use such ebooks, so I wouldn't be the person to test... but I think calibre is supposed to support EPUB3 with javascript, see for example:
https://www.mobileread.com/forums/showt … javascript
https://bugs.launchpad.net/calibre/+bug/1768138
https://bugs.launchpad.net/calibre/+bug/1717602
https://bugs.launchpad.net/calibre/+bug/1666519
https://bugs.launchpad.net/calibre/+bug/1651728

...
...

Keeping in mind JS is basically code execution, so this is exactly what you don't want:

progandy wrote:

Edit: There is readium as well. An epub reader is HTML based anyways, so electron doesn't feel out of place here. https://github.com/readium/readium-desktop

Electron is a horrible technology IMO, and when you consider that its whole purpose is to provide HTML/JS support as a full-fledged desktop computing experience, the very last thing you *ever* want to do is allow it to inadvertently execute untrusted JS. Real browsers have sandboxing. Electron allows you to execute subprocesses, read arbitrary files, etc. from JS, because, fundamentally, JS is serving the same purpose in Electron as C++ is serving in the components that were used to *build* electron.

Please read the warnings here: https://electronjs.org/docs/tutorial/security

The idea of browsers that are powered by electron, is *horrifying* from a security perspective. e.g. Brave. You're taking the chromium browser codebase, removing the sandbox and adding arbitrary code execution capabilities in order to write native desktop applications, and then using that to write a browser in JS that also executes JS, but tries to re-sandbox only the wrong type of JS?

The only way an ereader application written in electron would be safe, is if it did not support JS.
Applications that wish for real security while working in HTML should be using webengine/webkit via e.g. Qt5 or Gtk3 -- because yes, an ebook is fundamentally an HTML technology, so per default you should use an HTML rendering engine for it, but why ever would you choose electron is beyond me... qt5-webengine or webkit2gtk have perfectly suitable sandboxing platforms and are in fact used as the rendering component of actual, real, professional browsers. calibre uses qt5-webkit, which is basically the same thing except older, because the qt5-webengine port is still in-progress...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#11 2019-03-01 20:49:40

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: epub reader supporting javascript?

Thanks. I thought Electron did at least have sandboxing for embedded browser windows. I don't know why.

Last edited by progandy (2019-03-01 20:51:45)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#12 2019-03-01 21:15:52

stefano
Member
Registered: 2011-04-09
Posts: 287

Re: epub reader supporting javascript?

eschwartz wrote:
stefano wrote:
Lone_Wolf wrote:

I checked the file on Mac (Books app) and Android (Gitden). It works fine on both, so it is neither a defective file, nor does it use Apple-specific functions. It really seems to be a standard Epub3 file with enhanced JS stuff.

So it is EPUB3, which is good as EPUB2 definitely wouldn't work, but what is standard about enhanced JS stuff? tongue

Good point---I was sloppy. I simply meant that it is an epub file that does not use any platform-specific feature ("standard") but it takes advantage of the JS scripting capabilities introduced (AFAIK) with epub3 (the "enhanced JS stuff")



eschwartz wrote:
stefano wrote:
Lone_Wolf wrote:

It has fairly spotty support anywhere, and many reader applications don't even support EPUB3 in the first place, let alone "interesting" things like dynamic JS-based ebooks. You're generally on firmer ground when it comes to mobile devices, since there are a number of proprietary applications that both let you read these books, and try to sell you them.


I don't use such ebooks, so I wouldn't be the person to test... but I think calibre is supposed to support EPUB3 with javascript, see for example:
https://www.mobileread.com/forums/showt … javascript
https://bugs.launchpad.net/calibre/+bug/1768138
https://bugs.launchpad.net/calibre/+bug/1717602
https://bugs.launchpad.net/calibre/+bug/1666519
https://bugs.launchpad.net/calibre/+bug/1651728

I'll look into calibre again. But I'm not optimistic. I am still curious why MacOs, iOS, Android etc. allow epub3, though, if allowing arbitrary JS execution is such a security nightmare when not properly sandboxed (an argument I am sympathetic to, BTW). Is MacOS's Books app (or instance), providing such a sandbox? Just curious

Offline

#13 2019-03-01 21:25:35

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: epub reader supporting javascript?

They're not using the electron/nodejs "desktop programming language" runtime as their javascript engine.

iBooks uses the iOS system web browser engine that is part of Safari. (In fact, Apple policy is that apps are not permitted to ship their own alternative web renderer at all, so even Firefox for iOS is just a UI skin without Firefox's own Gecko rendering engine.) It is perfectly safe and has an entirely suitable sandbox, because it is not electron.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB