local storage and session storage

you can find an example on this page on hacks.mozilla.org

Instead of using the setInterval and blindly trying to send data to your server, check the navigator.onLine property:

if (navigator.onLine) {
   // Send data using XMLHttpRequest
} else {
   // Queue data locally to send later

You can also add listeners to the Window object for the "online" and "offline" events which will let you know when the browser has internet connectivity again.

These libraries belong here...

  • https://github.com/andris9/jStorage
  • https://github.com/marcuswestin/store.js
  • https://github.com/ZaDarkSide/simpleStorage