Reputation: 435
I'd like to understand better what works and what is not possible to run and render using JS + CSS in iBooks 2. Does Apple provide relevant documentation? Specifically I am trying to run a pre-written javascript quiz that runs fine in safari and as a widget, but doesn't run in iBooks and it's hard to guess as to what may be causing it.
Upvotes: 0
Views: 360
Reputation: 188
Apple doesn't explicitly say what is or isn't suppored in iBooks in terms of Javascript. The iBooks Asset Guide is your best bet and should usually be your first port of call for this kind of thing. In terms of this kind of documentation, it just states
iBooks supports JavaScript similarly to Safari. In books, JavaScript allows for features like drag and drop, and touch or mouse events to initiate audio or animation.
You can access the iBooksAssetGuide from iTunesConnect, under 'Deliver Your Content'. There are a fair few sections of guidance on js in iBooks.
I'd also download the Fixed Layout EPUB sample (currently version 3.1) provided there, which includes iBooks.js, a library that Apple provides for interactivity in iBooks. There are all kinds of event handlers and controllers in iBooks.js that may help you. They are mostly aimed at animation, handling media and the like, but I'm sure you could make it work.
Unfortunately, though, I don't think that a quiz that was built for the web is going to run as intended in iBooks. It's hard to tell without seeing the actual code in question, though.
Upvotes: 1