Make iBooks turn page (in reflow mode) with Javascript embedded in the displayed EPUB3 ebook

StackOverflow https://stackoverflow.com/questions/16922631

  •  31-05-2022
  •  | 
  •  

Вопрос

I have developed a library (which I will release under BSD/MIT license soon) to simulate Media Overlay support (aka "read aloud" or "SMIL") for reflowable EPUB3 eBooks in Apple iBooks. (I remind you that iBooks supports MO only in FXL layout mode, unlike Readium or Azardi.)

I would like to make iBooks "turn" page when the current active SMIL fragment leaves the current page and goes to the next one. To do so, I need to:

1) realize that the active fragment has gone outside the current page, and 2) force a page turn.

The first point can be (cumbersomely) achieved by computing the SMIL element offset; I am stuck at performing 2).

In Apple's ibooks.js there is nothing helpful, and injecting TouchEvent's does not seem to work, because they are reported to the active document and not to the "host WebKit".

Any ideas how to make iBooks turn page from within a JS loaded by the currently displayed EPUB3 reflowable ebook?

EDIT: following this question up, I released the aforementioned JS here: https://github.com/pettarin/rb_smil_emulator

Это было полезно?

Решение

If you are talking about progressing to the next XHTML document, then it should be adequate to simply do

location.href="nextpage.xhtml";

If you are talking about moving within the same XHTML document, then the best you can do is to somehow identify the location within that page using an ID'd element, and jump to it:

location.href="#id";

There is no way that I am aware of to simply execute/simulate a page turn.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top