Site is used on Samsung Galaxy Tab with the Gingerbread OS. Browsers used so far are the stock browser as well as Dolphin HD. Items in local storage seem to at random disappear when users go in and out of network coverage. Storage also seems to not be able to fully survive browser crashes or device restarts. Weird part is storage doesn't usually clear out pletely, just a large number of items go missing. Anyone else heard of this problem or have any suggestions?
Edit: By local storage I mean,
localStorage["Key"] = value;
Retrived using:
localStorage.getItem("Key");
In every case, directly after adding to local storage, the site is able to retrieve and use the data. However, sometime after this usually after roaming or browser/tablet crashes, the data is no longer there. Everything I've found says local storage should persist, so I don't really know where to go from here.
Site is used on Samsung Galaxy Tab with the Gingerbread OS. Browsers used so far are the stock browser as well as Dolphin HD. Items in local storage seem to at random disappear when users go in and out of network coverage. Storage also seems to not be able to fully survive browser crashes or device restarts. Weird part is storage doesn't usually clear out pletely, just a large number of items go missing. Anyone else heard of this problem or have any suggestions?
Edit: By local storage I mean,
localStorage["Key"] = value;
Retrived using:
localStorage.getItem("Key");
In every case, directly after adding to local storage, the site is able to retrieve and use the data. However, sometime after this usually after roaming or browser/tablet crashes, the data is no longer there. Everything I've found says local storage should persist, so I don't really know where to go from here.
Share Improve this question edited Nov 17, 2011 at 9:30 Cjxcz Odjcayrwl 22.9k43 gold badges149 silver badges231 bronze badges asked Nov 9, 2011 at 22:42 jmeasejmease 2,5355 gold badges49 silver badges89 bronze badges 11- 2 Suggestion: Show some relevant code, so that others can verify it. – Rob W Commented Nov 9, 2011 at 22:44
- The latest generations of mobile browsers tend to clear local storage at the same time cookies are cleared. Could that be what's happening? – Eric J. Commented Nov 9, 2011 at 22:45
- 1 Just a general question. Items added by localStorage["Key"] = values that are there throughout use of the site are suddenly not there any more at random times. Usually after roaming or after a browser crash. I've only been able to replicate it once, but several users per day run into it and causes quite a problem when it happens. Just wondering if this is a known issue and if other HTML5 offline storage methods are more reliable? – jmease Commented Nov 9, 2011 at 22:47
- 1 I suggest you to use WebSQL, although W3C had decided to use Index DB to replace WebSQL, the Index DB is not available on both Android and iOS, while the WebSQL is still available and used by many pany as the offline storage. – Yu Jianrong Commented Nov 19, 2011 at 15:47
- 1 An important benefit of WebSQL than LocalStorage is: when the LocalStorage is full for this site, your new setting on the storage will be failed on iOS and there is no way en enlarge the storage. But if you use WebSQL on iOS, the user will be prompted to enlarge the offline database, when you create a database bigger than 5M, 10M, 25M and 50M. – Yu Jianrong Commented Nov 19, 2011 at 15:49
1 Answer
Reset to default 3How about debugging this a bit further? Maybe your own code is somehow overwriting it? I am using localStorage/sessionStorage in PhoneGap and never had them disappearing...
Add the following event handler:
window.addEventListener("storage", function(e) {
console.debug(e);
}, false);
Which will fire (and log to console, on desktop browser) every time the storage is accessed. You could also log more detailed info to be seen in your adb logcat (like the key being accessed!)
Have a look at this stackoverflow question for more details on Storage events.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745246794a4618445.html
评论列表(0条)