views:

81

answers:

2

I'd like my web page to allow the user to add data, even when he's in offline mode and maybe store the data in local storage (cookies, html5 storage). When the user gets back online again, the page should detect the live connection and post the data to server.

Is there a mainstream way to do this? Maybe a javascript library or plugin?

A: 

Maybe Google Gears and Gears API?

nicerobot
google declared gears end of life, so that might not be the best option i'm afraid.
futtta
Sure, but only because they're helping to move the capabilities of Gears into HTML5. http://gearsblog.blogspot.com/2010/02/hello-html5.html "We realize there is not yet a simple, comprehensive way to take your Gears-enabled application and move it (and your entire userbase) over to a standards-based approach. We will continue to support Gears until such a migration is more feasible, but this support will be necessarily constrained in scope." So i still stand by the recommendation, if such a capability is required _now_.
nicerobot
A: 
  1. save your (json-ified) data in html5 localstorage (or use a library like persistJS to have full cross-browser support, see this blogpost for an example on storing structured data this way)
  2. have a background process check if browser is online to sync with server (see this article on hacks.mozilla.org for an example of online syncing).
futtta