I have extremely weird behaviour in Chrome: Version 61.0.3163.79 (Official Build) (64-bit).
I keep a token in localStorage and I cannot remove it permanently. Now matter whether I do it programmatically by localStorage.removeItem('token')
or by Chrome tools in the application tab, this token keeps coming back. After removing the token, when I refresh the page, token is not there, but once I close this tab and open a new one for my application, this token is resurrected!
Also, when I have multiple tabs opened, when I refresh pages, some tabs see this token, some not, and it shouldn't be like this as localStorage should be global for all tabs.
I have no idea what this is, a new Chrome bug?
I noticed the same behavior and verified that it did not work this way in Chrome version 60.
It looks like a bug in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=765524
As a workaround, I changed
localStorage.removeItem('token')
to
localStorage.setItem('token', '')
and that seems to give me the expected behavior (i.e. logout works).
In 2022 it seems still be the case, at least I've failed to remove an item with the mouse right click → context menu → delete
But I've managed to do it via a double click on the key value, which puts you sort of into an edit mode, so that one can just then press Backspace and the key is removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With