localStorage object is undefined in IE

Mikulas Dite picture Mikulas Dite · Aug 2, 2010 · Viewed 32.5k times · Source

I'm using localStorage in my JS application and I was wondering why IE9 claims localStorage == undefined. As far as I know, IE8 supports it, is here any way to get it working in the new version?

Answer

Alex Jasmin picture Alex Jasmin · Aug 3, 2010

Are you testing this on a local HTML file? i.e. a file:/// URL?

localStorage is only available on HTTP websites. That hasn't changed in IE9 Dev Preview.