开发者

Need a way for users to enter data while offline and re-submit it when back online

开发者 https://www.devze.com 2023-01-01 06:51 出处:网络
As part of a larger webapp, I want to build functionality that allows a user to enter data while offline -- and then send that data back to my site when they have a connection again

As part of a larger webapp, I want to build functionality that allows a user to enter data while offline -- and then send that data back to my site when they have a connection again

The parts that, to me, ar开发者_如何学Pythone missing ar

  1. Saving a certain set of data in their browser
  2. Saving a form that allows them to enter data
  3. using form from step#2 to update data from step#1
  4. getting data out of the local data store and sending it back to the server

I would like to keep this entirely within the browser, so...

Does HTML5 meet some (or all) of those goals as it's currently implemented in webkit/ff3?

If not,what technologies should I start looking into in order to accomplish all of the above.


As listed, it sure sounds like a bleeding edge browser utilizing HTML5 would take care of this for you.

While you could probably get away with using the local/sessionStorage object, I'd push to implement a client-side database.

  • Brief rundown on the WebKit blog

Using a cache manifest you could pretty easily maintain a functioning form while the user is offline.

  • See section 3, Offline Application Caching APIs here.

As for syncing up the fresh data, you should be able to get at it in any number of ways, leaving the logic and the method up to you.


placing information into a cookie with JS would be the easiest, which you can then automatically read on the backend (and when the page has been requested from the server - you know they got the connection back)

or do you want to avoid cookies?


https://github.com/ankit90anand/offorms

I used localStorage and navigator.online

0

精彩评论

暂无评论...
验证码 换一张
取 消