LocalStorage Getting NULL?

I am not sure why, since I did this before, and it worked fine, and I think it could be due to a browser problem / error:

localStorage.setItem('foo', 'bar')
alert(localStorage.getItem('foo'));

I'm in Firefox 3.6.6 and it warns the bar, but if I do this:

//localStorage.setItem('foo', 'bar')
alert(localStorage.getItem('foo'));

I get NULL. He must return the bar even as he is in my store.

In addition, it is simply the web page on which it operates.

+3
source share
1 answer

Do you run the script locally through file:?

If so, Firefox does not seem to allow records localStorageto live outside the upload when used file:.

: "localStorage" Firefox , ? , - .

+7

Source: https://habr.com/ru/post/1755859/


All Articles