Skip to main content
Baldur Bjarnason

Javascript in epub

Baldur Bjarnason
I used some spare time this afternoon to throw together a few ePub experiments

After throwing together the Modernizr ePub experiment earlier today I decided throw together another one. The code isn't the prettiest I've written, the page itself is ugly as sin, and some of the transitions are a bit jumpy, but on the whole it works.

In web browsers, that is.

Two out of the three experiments work in iBooks, the third does not. It's a slideshow of three images. When you press 'next' in the third experiment, the first image fades out as it should, but the next image doesn't appear. However, if you double tap where the image should be, iBooks opens up the full-screen thing it does and displays the correct image, so it obviously knows what should be there, but isn't displaying it.

Now, in a web browser I'd be able to open up Firebug or a Web Inspector and figure out what it is that's causing this, whether it's a bug in the app, in my code or something else. In iBooks… well.

Other issues with these experiments is the rendering model necessitated by the lack of positioning in ePub which caused problems at every point and at every level and that is entirely due to the idiocy of those who hammered the standard together.

You can see the html page from the ePub here, or, if you wish, you can download the ePub file itself.


ETA (July 2012): Apple turned off access to many of these APIs a while back. The lesson is that iBooks isn't a stable development environment.