views:

41

answers:

1

Is it possible to store objects in globalStorage or is it only capable of strings?

One option would be to "jsonify" an object and then store it but I wondered if theres a better way?

var host = location.hostname;

globalStorage[host].test = {
 name1: 'Ben',
 name2: 'John'
};

globalStorage[host].test2 = 'hello';

alert(globalStorage[host].test.name1); //undefined
alert(globalStorage[host].test2); //hello
A: 

No, unfortunately data is only stored in globalStorage as strings.

you could take a look at the database object, if your target browser platform supports it.

thomasmalt