I have an HTML5 offline application that works rather well, the cache validates, and it works in general, until I actually force the device (or computer) offline.
I have a handler attached to window.applicationCache.onerror
so I can handle and present a prompt for any random errors that may occur:
window.applicationCache.onerror = function (e) {
console.log(JSON.stringify(e));
model.errorInfo(JSON.stringify(e));
model.cacheError(true);
};
However, this error handler also fires when the device is offline, which throws up the error dialog, when it really shouldn't.
The JSON this spits out is as follows:
{"cancelBubble":false,"returnValue":true,
"srcElement":{"onobsolete":null,"status":1},"defaultPrevented":false,
"timeStamp":1351875347729,"cancelable":false,"bubbles":false,
"eventPhase":2,"currentTarget":{"onobsolete":null,"status":1},
"target":{"onobsolete":null,"status":1},"type":"error"}
I see nothing here too obvious on what I can look for to handle this paticular case. Should I be ignoring errors based on something in here, or doing something else entirely?