Hey Oskar,

Element.Storage is not a part of the DOM tree by design, and is designed to be emptied when the user leaves the page. This is to prevent certain leaks, (the behavior you describe is actually a leak by definition).

However, I can see how the behavior you describe would be useful, so if you'd like you could perhaps overwrite window.store / window.retrieve to use window.name as some form of persistent storage. Or you could create a new plugin alltogether with a unique API... maybe something like:

PersistentStorage.store('name', 'value');
PersistentStorage.retrieve('name');

You could put a hash in window.name and and store and retrieve from it maybe?

Tom


On Oct 1, 2008, at 10:30 AM, Oskar Krawczyk wrote:


Hi folks,

I was trying to figure out a way of using Element Storage on the
window object but it doesn't seem to work as I'd expect. Basically I'm
doing this:

window.store('name', 'some value');

Which works fine but only if we don't leave the page, as soon as we
leave it, the value is being lost - which it shouldn't as that's a
"window session".

Which leads me to the question: Is Element Storage something that is
being done virtually - it is not a part of the DOM tree, is it? Is
that how ES should work?

Best,
Oskar

Reply via email to