HTML5 seems to provide 5 MB of local storage, which is stored until cleanup and is useful for storing JSON values using XMLHttpRequest.
The HTML 5 navigator.onLine property provides offline detection. True if online, false if not
var nav = window.navigator;
if(nav.onLine) {
}
window.addEventListener('online', function() { });
window.addEventListener('offline', function() { });
For more information, check Creating Hybrid Mobile Applications with HTML5
source
share