1

I'm working on a full-screen fixed layout epub requiring iBooks 3. I've noticed other books display an alert on launch requesting that users with an earlier version of iBooks upgrade. I can't find any information on how to implement this, and whether it's something that iBooks takes care of or some sort of custom Javascript code.

The following meta tags included in an epub exported from iBook Author looked promising, but in sideloading tests did not work. Of course, I'm just dropping these into the .opf of an epub created without books so it's possible there's something else that iBook Author is doing that makes this work.

<meta name="ibooks:requiredVersion" content="3"/>
<meta name="ibooks:currentVersion" content="3"/>
<meta property="ibooks:version">3.0</meta> 

I looked into writing custom code, but Javascript alerts don't seem to work in iBooks. Any help would be greatly appreciated!

  • When you say "did not work", do you mean they generated an epubcheck error, or just didn't function as intended? Did you declare the ibooks prefix using `prefix="ibooks:http://vocabulary.itunes.apple.com/rdf/ibo\ oks/vocabulary-extensions-1.0/"` on the `package` element of `content.opf`? –  Apr 09 '13 at 09:47

1 Answers1

-1

Javascript alerts do work in iBooks, although I'm not sure how you incorporate them into iBooks Author.

A script element in your <HEAD> section will generate an alert:

<script language="Javascript">
<!--
alert ("Alert Message")
//-->
</script>

At worst you could probably manually edit the xhtml files iBA produces to insert this.

Freney
  • 1,174
  • 1
  • 11
  • 26
  • One more thing: you need to add 'properties=scripted' to the .opf entry to validate the ePub, although iBooks will still accept it without that tag. – Freney Mar 25 '13 at 04:20
  • The OP does not want to know how to put up an alert, he wants to know how to have iBooks check its version against the book requirements. –  Apr 09 '13 at 09:46
  • His final paragraph "I looked into writing custom code, but Javascript alerts don't seem to work in iBooks" seems to indicate otherwise. This is how Javascript alerts work in iBooks. – Freney Apr 09 '13 at 23:28
  • I'd note that most people these days do not use the XML comments in script tags, in fact it's deprecated; see http://stackoverflow.com/questions/808816/are-html-comments-inside-script-tags-a-best-practice. If you're going to specify a language, it should be JavaScript, with an upper-case S, but this is deprecated, and instead you should specify `type="text/javascript". In HTML5, which is what we are talking about for iBooks, the type attribute is not necessary either. Note also that there is nothing special about the HEAD element in terms of generating alerts. –  Apr 10 '13 at 00:55
  • Sure, fine, but the question still asked how to generate an alert. Well, technically, asserted that they *didn't* work. I provided one way (that, admittedly, can be improved upon) to do that. – Freney Apr 10 '13 at 01:05