local storage and session storage

These libraries belong here...

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

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.

Tags:

Html

Jquery