I'm developing a web app for iPad (3G) that requires offline database storage.
At first I tried using HTML5's LocalStorage API. When testing, I learned that if I navigate away from the page and power off the device (both iPad and iPhone), when I reopen the page later, my data cannot be accessed via LocalStorage (database appears to be missing).
I see this behavior at http://diveintohtml5.ep.io/examples/localstorage-halma.html with iOS devices, but Android devices (Droid X and Galaxy) and a PC running WinXP + Safari maintain my data across a restart.
I get appropriate behavior on the iOS d开发者_Python百科evices using Webkit's own "client-side database storage", like what can be seen here: http://blog.darkcrimson.com/2010/05/local-databases/.
Has anyone seen this problem with LocalStorage? Does anyone know why the database wouldn't be maintained on iOS devices? Does anyone have a solution?
The problem seems to be with the version of iOS. I had this issues with v4.3 on an iPad, and v4.3.1 on an iPhone. v4.2.1 on an iPad works just fine. v4.3.2 on an iPad will maintain the data across power-off, but NOT for clearing the cache. I hope this helps someone else.
精彩评论