Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 LocalStorage not persistent on iOS after Power Off

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 devices 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?

like image 816
Ryan Avatar asked Apr 13 '11 20:04

Ryan


1 Answers

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.

like image 145
Ryan Avatar answered Nov 04 '22 10:11

Ryan