Reputation:
Is localStorage
cleaned after I close my browser?
Upvotes: 3
Views: 1787
Reputation: 5899
No, it should not be cleaned by default. It might get cleaned if you cleaned it manually. Also private/inkognito browsing cleans it after you close the browser.
Upvotes: 4
Reputation: 630349
No, it's not cleaned then (that would kind of defeat the point!).
...unless you're browsing in some sort of privacy mode, in which case the browser may clear it, this may vary by browser as to how it's implemented,and certainly will vary over time...since they all handle the "private mode" differently.
On the other hand if you want to clear it, there is a method: localStorage.clear()
Upvotes: 2