Friday, June 14, 2013

If everything that exists in localStorage and sessionStorage exists in a dictionary with string keys and string values, can you store an object in such locales?

Yes! Put something in:

sessionStorage.setItem("foo", JSON.stringify(myObject));

 
 

Pull it back out:

var foo = JSON.parse(sessionStorage.getItem("foo"));

No comments:

Post a Comment