I created a widget in dashcode that embeds a YouTube video. I'd like to test for an interent connection first and alert the user. I embedded the YouTube widget into iBooks. I'm guessing at times some will not have an interent connection.
if I add:
var online = window.navigator.onLine;
if (!online) {
alert("we are offline");
//console.log("We are offline!");
} else {
alert("we are online");
//console.log("We are online!");
}
And add that code to iBooks Author as a widget, the popup works fine, but there's no way to confirm the alert. Basically, it locks up the iBook. Any ideas?
I'm not sure about ibook dashboard, but I wrote a heartbeat checker for my web app that could be used to confirm http connection, perhaps it could do what you need... original post here
You call the code with a URL to check, a max ttl, and a callback. If the page has not responded by the end of the ttl (in milliseconds) the callback is called with null else you get the status and the request object.