H
H
HyperSir2017-10-25 19:33:42
JavaScript
HyperSir, 2017-10-25 19:33:42

Why is the localStorage content of sites not saved after closing the browser window?

The localStorage content of sites is not saved after the browser window is closed. I use Chrome, I specifically checked it in FF, the versions are up to date. OS - Windows 8.1, account - the only one, administrator, launching browsers - on behalf of the administrator. Accordingly, no site settings are saved, as, for example, in Youtube (viewport size, autoplay, volume, etc.), well, it interferes with coding, I need localStorage.
localStorage.setItem('key', 'item value')
Restart browser, get
localStorage.getItem('key') == null

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2017-10-25
@SagePtr

If the problem manifests itself in several browsers, then it is possible that there is a program like an antivirus or some kind of cleaner, and it is configured to remove traces of browsers when it exits.

B
bqio, 2017-10-25
@bqio

Have you used window?

window.localStorage.setItem('key', 'item value')
window.localStorage.getItem('key')

Everything works even on jsfiddle: jsfiddle.net/oqt86mz6 You have a
problem somewhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question