I have searched through StackOverflow and have seen various topics on how to do this, but nothing that really pertains to my particular situation. I am writing (for a class)
You can either check the navigator.onLine
property or listen to the offline
/online
events:
$(document).on('offline online', function (event) {
alert('You are ' + event.type + '!');
});
Source: http://www.html5rocks.com/en/mobile/workingoffthegrid/
And here are some MDN docs for these events: https://developer.mozilla.org/en/Online_and_offline_events
I'm not familiar with these events myself, but if you read the above links, you should find a lot of good information.