I guest you use HTML5 for you task? In the case answer is yes, is ease save local data for your use in offline mode. You can read this tutorial for localStorage object Local Storage in HTML5
Now, the next code help you to save online data in local storage, and access this in offline:
function init() {
var googleMapObject = null;
// This is first status verification
if (navigator.onLine) {
googleMapObject = anyMethodToGetData();
// Save remote object in local storage
localStorage['googleMapsObject'] = JSON.stringify(googleMapObject);
} else {
// In offline mode, return local storage data
if (localStorage['googleMapsObject']) {
googleMapObject = JSON.parse(localStorage['googleMapsObject']);
}
}
return googleMapsObject;
}
The init method is call in load/ready event. If you need detect change in online/offline state, use online/offline events.
Regards!!