HTML5 Local Storage Not Persistent

后端 未结 1 543
萌比男神i
萌比男神i 2021-01-04 09:21

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 disa

1条回答
  •  萌比男神i
    2021-01-04 10:19

    How 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.

    0 讨论(0)
提交回复
热议问题