I am facing a strange issue in Firefox (62.0.3). The values set in localStorage
are sometimes lost in a new tab.
I can reproduce this with the following HTML, when served by a web server (I used node/express).
<!DOCTYPE html>
<html><body><script>
window.onload = () => {console.log(window.localStorage.myVal || 'undefined')}
</script></body></html>
Steps:
- open page, page displays
undefined
- run script in console
localStorage.myVal='defined'
- reload page, page displays
defined
- when opening the page in a new tab it displays
undefined
ordefined
at random. (I opened 10 new tabs and results seemed random)
Maybe I have set something in Firefox which causes this, but since the behaviour is at random I am somewhat puzzled.
The example above is just to demonstrate the problem. The Actual application where this problem first happened was a react/redux application using localStorage.