Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localStorage not supported by IE9?

Everybody say that window.localStorage is supported by IE (until IE8)

I test it on IE9 but :

console.log(typeof window.localStorage)

undefined

what does it mean?

What's the best way to store local data for all browser?

like image 390
Valeriane Avatar asked Nov 09 '12 09:11

Valeriane


People also ask

Is IE9 supported?

For versions of Windows where Internet Explorer 9 was the final version of Internet Explorer available, support ended alongside the end of support for that version of Windows. On January 14, 2020, Microsoft released the final IE9 update for Windows Server 2008, marking the end of IE9 support on all platforms.

Why we should not use localStorage?

Why Local Storage is Insecure and You Shouldn't Use it to Store Sensitive Data. Here's the deal: most of the bad things about local storage aren't all that important. You can still get away with using it but you'll just have a slightly slower app and minor developer annoyance.

Is localStorage available on all browsers?

Local Storage is "local" in that exact browser and ONLY in that browser. To retrieve something stored in Local Storage, you must use the same browser, the same key and retrieve it from a page in the same origin (e.g. domain).

Can browsers block localStorage?

It is important that you know them so you can block them or delete the data stored by them: Browser local storage. Some websites use the browser's "sessionStorage" and "localStorage" to store data; "sessionStorage" is stored temporarily, but the “localStorage” is persistent.


1 Answers

Local Storage is stored relative to an origin.

This means you must open your page using http://someorigin/pathtoyourpage.html. It can't work on IE if you're opening the page in file://pathtoyourpage.html (and shouldn't work on other browsers).

So you need to access your page using a web server (it can be on localhost).

like image 138
Denys Séguret Avatar answered Sep 30 '22 10:09

Denys Séguret