Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE7 key:value pairs persist across single pages but not entire domain #2

Open
leereamsnyder opened this issue Mar 1, 2012 · 3 comments

Comments

@leereamsnyder
Copy link

It's entirely possible that I'm missing something here, but in IE7 the key:value pairs are not persisting across the entire domain.

They are persisting across page refreshes and browser restarts for individual pages, but as soon as I go to a different page on the same domain, the data is no longer there.

Here's what I'm doing. I'm trying to store a setting across pages. After I load your script, I test if a localStorage value exists already. If it doesn't exist, then I create/set the value:

var settingExists = typeof localStorage.getItem('theKey') === "string";

if ( !settingExists ) {
  localStorage.setItem("theKey", "the value");
}

That works great on a page refresh. But when I go to a different page on the same domain, localStorage.getItem('theKey') returns null (where I would expect it to be set already from the previous page).

Am I missing something really basic here?

@brettwejrowski
Copy link
Contributor

Thanks for bringing this up, I was under the impression that it did work across a domain but I will have to go back and take another look.

@wpowers
Copy link

wpowers commented Apr 19, 2012

Was this ever addressed?

@kapitancho
Copy link

I also use this behavior in general, but the approach is useless because IE userData is per folder. This restricts the url structure a lot. My workaround is to have a single Iframe that contains the userData. This way, I have a shared localStorage. The only drawback is that I have to rely on an iframe load event that will usually fire after the main page load event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants