Software Archive
Read-only legacy content
17061 Discussions

localStorage bug: converts empty string to null

Tom_B_2
Beginner
458 Views

Hi,

I've been using intel XDK for a while now, and found a disturbing bug:
When assigning an empty string ("") to a localStorage variable, the next run will turn that variable to null.
I've seen this behavior on iPhone4 with AppPreview, have not tested the app on its own.
I'm currently fixing this within my code, but this is a strange behavior. Hope to see it resolved in future releases.

Regards,
Tom

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
458 Views

The global localStorage object is provided by the webview on the target device, it is not provided by the XDK, thus we cannot change the behavior of that API, it is dependent on the target device. When you build an XDK application you are building a Cordova app, so you can search for something like "localStorage issue Cordova PhoneGap Android" (for example) to see other solutions out there regarding this problem. 

To help with understanding what a webview is, please see this blog > http://blogs.intel.com/evangelists/2014/09/02/html5-web-app-webview-app

0 Kudos
Reply