HTML5 Local Storage Not Persistent

社会主义新天地 提交于 2019-11-30 17:47:46
Leon

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!