Right now I add a couple of event listeners to check when the phone goes online/offline.
document.addEventListener('online', onOnline, false);
document.addEventListener('offline', onOffline, false);
This works fine, but since I’m attaching the listener to the document, it applies to every page in my app.
How would I do this for only one page? (Or several maybe, but not the whole app).