Quote:
Originally Posted by Ghitulescu
I wonder whether it is possible to implement a sort of history.back(-1) in an ePub, as not all eReaders allow such a functionality?
|
@Ghitulescu: I experimented with this some time ago, but finally gave up on it, because it'd require ePub3 apps/readers with JavaScript support. And since most ePub3 apps also have popup footnote support, it's somewhat pointless to implement a JavaScript solution.
(For more information on popup footnotes, see
this post.)
My (valid) ePub3 test file uses
onload,
onclick and
localStorage to save the id of the footnote reference and to dynamically generate backlinks that simulate the back button.
The book contains 3 chapters with identical footnote links and a footnotes html file with dummy definitions.
For debugging purposes the ePub will also display the id of the calling footnote reference and the href of the backlink via
alert().
However, the only mobile app that it worked with was iBooks for iOS and the only PC ebook app it worked with was ADE 4.5.x.
(It also works with Sigil 0.9.5 or higher.)
However, since I only have very limited JavaScript skills, it's quite possible that there's a subtle JavaScript bug that I missed. I attached my file to his post so that ebook designers with much better JavaScript skills than me can have a look at it.
BTW, if you open the book with an ePub app without JavaScript support, the footnotes won't have backlinks, but the footnote links should still work.