Currently, I’m trying to pass a multidimensional array in Phonegap between two pages with window.localStorage. In main.js, I use
var storage = window.localStorage;
storage.setItem("information", myArray);
window.location = "summary.html";
And in the file summary.js, I use:
var storage = window.localStorage;
var myArray = storage.get("information");
When I run this, myArray only returns undefined. I know that it is fully defined right before I call window.location = "summary.html";. My best guess to the problem right now is that there is an error in either storing or retrieving an array, at least the way I’m doing it. Can you not pass Arrays through localStorage, or am I doing something wrong?
I typically use
JSON.stringifyandJSON.parsewhen getting or saving items to local storage. I believe most implementations only support strings at the moment.