Chris
Chris

Reputation: 111

HTML5 Offline Storage / Web SQL

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:

Can anyone point me in the right direction here?

Thanks,

Chris

Upvotes: 4

Views: 1922

Answers (3)

axemclion
axemclion

Reputation: 61

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.

Upvotes: 1

tkone
tkone

Reputation: 22728

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.

Upvotes: 0

JKing
JKing

Reputation: 847

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.

Upvotes: 1

Related Questions