Roberto
Roberto

Reputation: 143

IE9 Beta Support for localStorage

Does anyone know if current IE9 Beta fully supports HTML5 "localStorage" functionality? Normally the test for "localStorage" support can be done with js code just like:

try {
    return  ('localStorage' in window) && window['localStorage'] !== null;
} catch (e) {
    return false;
}

Well, it seems that this kind of test returns "true" but if you try something like:

localStorage.removeItem ('key')

you get an error on the Javascript Console (SCRIPT16389 error). Any more info?

Upvotes: 3

Views: 5428

Answers (4)

ron tornambe
ron tornambe

Reputation: 10780

The reason your test returns true is that the statement: window['localStorage'] returns "undefined". Change your test to: window['localStorage'] != null (or != undefined) and it will return false.

My version (9.0.8112.16421IC) of IE9 does not seem to support localStorage either.

Upvotes: 3

EricLaw
EricLaw

Reputation: 57115

There was a regression with removeItem in IE9 beta.

A bug was filed on the Connect bug reporting database. https://connect.microsoft.com/IE/feedback/details/613497/web-storage-remove-method-not-working-according-to-the-spec

Upvotes: 1

Wernight
Wernight

Reputation: 37668

As you can see on Comparison of layout engines (HTML5) on Wikipedia Web Storage should be supported.

PS: IE9 is Trident 5.0. (thanks EricLaw -MSFT- for the mistake).

Upvotes: 0

Yi Jiang
Yi Jiang

Reputation: 50155

Not entirely sure what the problem here is, because localstorage has been functional in IE since version 8. See:

http://msdn.microsoft.com/en-us/library/cc197062%28VS.85%29.aspx
http://www.quirksmode.org/dom/html5.html

And also, this working example I whipped up: http://jsbin.com/ijega3/edit

Upvotes: 4

Related Questions