02-27-2013, 03:40 PM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
|
Including jQuery in an ePUB3.0 eBook
Because ePUB3.0 supports JavaScript, I'm wondering if it's also possible to embed the jQuery source in eBooks so it's possible to include jQuery scripting. I haven't the faintest idea of how to go about this. Is it even possible?
Thank you! |
02-27-2013, 04:18 PM | #2 |
Digital Amanuensis
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
|
Technicly, it is possible, but the problem, as always with EPUB 3, is the support in reading applications/devices.
Specifically, iBooks has some problems with jQuery (I did some testing a couple of months ago, I do not rember exactly what went wrong). Readium should be ok. But other readers (say, Blio) completely ignore the JS embedded. EDIT: for the "how", have a look at the IDPF samples. Basically, include your JS script, add it to the manifest, and add "scripted" property to the page(s) using it. |
02-27-2013, 05:09 PM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
|
Thank you for your response, AlPe. I can embed normal javascript into an eBook without any issues and it'll display just fine on the iPad. I'm wondering if the iPad can natively understand and display jQuery code or if I would have to embed the jQuery source code in the eBook or use some sort of namespace reference in the header, etc., and if so how that's done. Thus far all of my attempts have been for naught. I'm beginning to think it's not possible, unfortunately.
|
02-27-2013, 05:19 PM | #4 | |
Resident Curmudgeon
Posts: 73,983
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
02-27-2013, 05:26 PM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
|
I think most anyone can safely assume that when I said "on the iPad" I was referring to its native eBook display program, iBooks. Thanks for contributing to the discussion, though.
|
02-27-2013, 05:26 PM | #6 |
Resident Curmudgeon
Posts: 73,983
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It's not native. It's an add-on app. Why should we have to assume? Why can't iBooks just be specified when that's what you mean?
|
02-28-2013, 01:23 AM | #7 |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
For the most part, I would expect jQuery to work the same way that it does in Safari. This is not to say that you won't find interesting bugs and edge cases where jQuery does the wrong thing, of course. If you find such problems, file bugs with jQuery, and if they conclude it's a bug in iBooks, then file bugs against iBooks.
But yes, you almost certainly will have to embed the jQuery library code in the book. To the best of my knowledge, EPUB books are not allowed to use resources outside the book bundle; they must be self-contained. |
02-28-2013, 07:47 AM | #8 | |
Digital Amanuensis
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
|
Quote:
Code:
<script src="path/to/your/script.js" type="text/javascript"></script> Code:
<item id="p001" href="path/to/your/p001.xhtml" media-type="application/xhtml+xml" properties="scripted"/> <item id="s001" href="path/to/your/script.js" media-type="text/javascript"/> Code:
<option name="interactive">true</option> |
|
02-28-2013, 07:51 AM | #9 | |
Digital Amanuensis
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
|
Quote:
(FYI, audio/video resource might be outside the EPUB 3 container: http://idpf.org/epub/30/spec/epub30-...urce-locations ) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
App Syncs "copied" text (including eBook clips) between iOS and OSX | 1611mac | Apple Devices | 6 | 01-25-2013 08:23 AM |
Free ~ Dante Alighieri - Audio eBook EPUB3 of the Divine Comedy, read by Lino Pertile | AlPe | Self-Promotions by Authors and Publishers | 2 | 12-13-2012 04:13 PM |
epub3 | pbs_ebook | Writer2ePub | 1 | 05-06-2011 11:47 AM |
including RSS item pubDate in ebook text | alison87 | Recipes | 2 | 02-05-2011 04:40 PM |