4

I've been asked to research offline storage options for web forms on mobile devices (mainly sign-up forms on iPads for use at large events where due to huge numbers and location connectivity always seems to be an issue).

What I'd like to come up with is something like:

  • A form that can submit data when connected, or store if offline when not.
  • Check the connection periodically and submit the form data when able.

Can anyone point me in the right direction here?

Thanks,

Chris

3 Answers 3

1

Sounds like you just need key/value pairs. window.localStorage is your friend!

It's key/value storage that persists through page refreshes, and across all pages in the same domain (eg: run window.localStorage.userName = "John Doe"; somewhere on "http://www.somedomain.com/index.html" and then when the user goes to "http://www.somedomain.com/page2.html" if you run "window.localStorage.userName" it will still return "John Doe".

Let me know if you need code snippets.

Sign up to request clarification or add additional context in comments.

1 Comment

Some snippets would be very much appreciated! Thanks!
1

You could use the html 5 indexedDB API - http://nparashuram.com/IndexedDB API.

The HTML5 WebSQL API is now no longer in active maintenance and IndexedDB seems to be something everyone is using.

You could use the IndexedDB-WebSQL polyfill - http://axemclion.github.com/IndexedDBShim to get it working on mobile devices, in addition to the desktop.

Comments

0

http://diveintohtml5.info will give you some good examples of how to use offline storage. as far as checking to see if you have a connection that is valid, you'll have to probably do something with XMLHttpRequest in the background or form submit rather then using a standard HTTP GET or POST method on your form submission.

1 Comment

Ah OK, I'm used to dealing with GET and POST so will have to research how we can use XMLHttpRequest for this, thanks for the advice!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.