How to debug scripted ePub3 in iBooks?

I have an ePub3 book with scripts that works great with Readium, but only partially on iBooks. I assume that JavaScript is at some point an error (although the exact same code works fine in Safari as a standard web application). Any thoughts on how to do this while debugging this?

+8
javascript debugging cross-platform ibooks epub3
source share
2 answers

Azardi Online can be used to read a file using a browser. For debugging, you can use the built-in or additional console. Or you can create a console spacer:

if(!console) { console = { "_log" : [], "log" : function() { var arr = []; for ( var i = 0; i < arguments.length; i++ ) { arr.push( arguments[ i ] ); } this._log.push( arr.join( ", ") ); }, "trace" : function() { var stack; try { throw new Error(); } catch( ex ) { stack = ex.stack; } console.log( "console.trace()\n" + stack.split( "\n" ).slice( 2 ).join( " \n" ) ); }, "dir" : function( obj ) { console.log( "Content of " + obj ); for ( var key in obj ) { var value = typeof obj[ key ] === "function" ? "function" : obj[ key ]; console.log( " -\"" + key + "\" -> \"" + value + "\"" ); } }, "show" : function() { alert( this._log.join( "\n" ) ); this._log = []; } }; window.onerror = function( msg, url, line ) { console.log("ERROR: \"" + msg + "\" at \"" + "\", line " + line); } window.addEventListener( "touchstart", function( e ) { if( e.touches.length === 3 ) { console.show(); } } ); } 

References

0
source share

You can enable Webkit Web Inspector in iBooks with this line in the terminal application to change its settings:

 defaults write com.apple.iBooksX WebKitDeveloperExtras -bool YES 

You will find the inspector after restarting iBooks in the context menu (Advanced> Show Inspector). All inspector tools are available, including console, etc.

+3
source share

All Articles