tomasb
tomasb

Reputation: 1673

In IE10 ('localStorage' in window) condition is true but localStorage is undefined?

Browsing all the questions/answers here but can't find a resolution to my problem. The condition ('localStorage' in window) returns true but object of localStorage itself remains undefined. <!DOCTYPE html> set properly, can't get it working. I am using IE10. Tried watch it via developer tools, the same result.

Any ideas here?

Edit

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

Based on the same issue in IE9 I would like to update the question: is there any workaround? I cannot use even static server on the machine I need to test on.

Upvotes: 1

Views: 996

Answers (1)

dezman
dezman

Reputation: 19378

I'm gonna go out on a limb here and say that your problem is that local storage wont work on file:// protocol in ie, so you need some kind of server.

Upvotes: 4

Related Questions