I want to store an XML document in sessionStorage. When I do this it seems to save ok as an XMLDocument. When I try to access it (on a page refresh) the object comes back as [object Object] as opposed to [object XMLDocument].
How do I get the data out of sessionStorage as an XMLDocument (or convert it to one?)
localStorageandsessionStoragecan only hold strings. Have a look at the interface definition:You cannot store objects unless you serialize them. So in your case, you have to serialize it to XML.
If you received the XML document as text, just store it directly. You can use
jQuery.parseXML()to parse it after retrieval.