View Single Post
Old 06-19-2016, 09:12 AM   #17
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,300
Karma: 19777777
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Ghitulescu View Post
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.
Attached Files
File Type: epub dynamic_links_epub3x.epub (32.1 KB, 340 views)
Doitsu is offline   Reply With Quote