Reputation: 5423
I have several pages marked non-linear in the metadata.opf file:
<itemref idref="id18" linear="no"/>
<itemref idref="id19" linear="no"/>
<itemref idref="id20" linear="no"/>
When this book is opened in Apple Books and I click/tap a link to one of those (say, from the table of contents, but also other places), instead of navigating to that page, Books seems to want to treat it as if it were some sort of footnote, and only displays a floating window or sorts (like hover text on a regular web page).
I would prefer it navigate directly to the page. In a web page (were it necessary), you could do something like onclick="window.location=url"
and it would work as if it were a regular link. Is there some way of accomplishing similar functionality in epub?
What javascript is supported at all is only thinly documented, there are no examples (let alone relevant examples)... I can't find much on this. If the javascript is ignored outside of Books, that'd be fine too, as other epub readers seem to be better behaved.
Links:
When Links are clicked:
Upvotes: 0
Views: 156
Reputation: 372
We use a fallback JS 'ahref' link on the XHTML page. The iBooks specs indicate JS coding is fine (iBooks 1.5 or later, iOS 5.0 or later, macOS X Mavericks 10.9 or later). The fallback code we used is:
<a href="./text/section-02.xhtml" class="button" onclick="location.assign('./text/section-02.xhtml'); return false;">Fallback</a>
This fallback simply means -- first the regular 'ahref' is fired at click, then IF for some unknown reason it didn't, the 'return false' says go to this page at the same click as 'onclick'. This info is from this source (plus there's good info at FF MDN Web Docs): StackO and at W3S .
There are several ways the JS fallback can be rendered 'assign', 'replace', 'href' and its worth reading the SO links in detail (it is a long discussion and there are several other links there worth reading too).
Also...The <aside>
tag may be the cause for the popup...
Or it may be the 'epub:type' within the code if its within the same web link....it may cause the epub to open that link as a popup box. Such as...
epub:type="noteref"
Upvotes: 2