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

localStorage test fails in IE if its disabled #40

Closed
paulirish opened this issue Jan 6, 2010 · 4 comments
Closed

localStorage test fails in IE if its disabled #40

paulirish opened this issue Jan 6, 2010 · 4 comments

Comments

@paulirish
Copy link
Member

http://twitter.com/kangax/status/7447765023

fix:
return ('localStorage' in window) && localStorage !== null;

@kangax
Copy link

kangax commented Jan 6, 2010

Or maybe return window.localStorage != null, which would weed out both — null and undefined (and so not declared too).

@paulirish
Copy link
Member Author

we have the in test as Firefox throws similar fits when cookies are disabled..

from the source
// both localStorage and sessionStorage are
// tested in this method because otherwise Firefox will
// throw an error: https://bugzilla.mozilla.org/show_bug.cgi?id=365772
// if cookies are disabled

@dperini
Copy link

dperini commented Jan 6, 2010

Maybe a test in advance for disabled cookies then ?
Write and re-read the same cookie, if cookies are disabled no error is thrown.

@paulirish
Copy link
Member Author

localstorage test failing in IE when it was disabled. thx kangax. closed by d8947c9. other optimizations

This issue was closed.
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

3 participants