iBooks recently started supporting JavaScript inside epub. Where is this documented?
Are there any code examples to get started?
iBooks recently started supporting JavaScript inside epub. Where is this documented?
Are there any code examples to get started?
** Update, one year later : This has been now documented for several months in the official Apple Docs available on iTunes Connect
From what i've seen, you already have quoted the best known sources.
I think that it is not documented anywhere in the official docs from Apple. Here are some elements from what I've experienced.
Features supported by iBooks
A lot of things that work on Safari work on iBooks too. You already have access to HTML5 features like internal DB, canvas, etc. The biggest problems I saw were related to slowness and vertical positionning. There are problems with pagination too : if you add content, pages are not added to the end and the content can overflow.
Validation for the iBookStore
Before being published on the iBookStore, it relates entirely on Apple's arbitrary validation when it comes to Javascript. I know at least one ePub with interactive forms and DB, that they have validated.
For lack of better resources, I created a open-source example of using JQuery to show an alert. Might be helpful as a starting point.
The examples you give refer to the interactivity in the body of the books. Javascript scripting can also be used within the HTML widgets:
HTML widget boiler plate on github -- https://github.com/TrevorBurnham/iBooks-HTML-Widget-Boilerplate.
iBook Widgets with D3.js -- http://vallandingham.me/ibooks_and_d3.html (to check the widget, click on 'download a copy of my iBook file', change the iba extension to 'zip', uncompress, navigate to vis-1.wdgt)
© 2022 - 2024 — McMap. All rights reserved.