I have the following html on a local file at ~/test.html:
<html>
<head>
<title>Test Event</title>
</head>
<body>
Test Event
</body>
</html>
I open it in two different windows in Chrome (Version 62.0.3202.75). In the console of the first window I enter the following JS:
window.addEventListener('storage', function(e) {
console.log('criou sdasd');
console.log(e.key);
console.log(e.oldValue);
console.log(e.newValue);
console.log(e.url);
console.log(e.storageArea);
});
In the console of the second window I enter the following JS:
localStorage.setItem('Chronometer.time', '00:00');
And nothing happens in the first window.
Interesting facts:
- If I run
localStorage.getItem('Chronometer.time')
on the console of the first window I get "00:00". - If I just open two new empty Chrome tabs and do the same steps above, I do get an event triggered in the first window.
Do storage events work on local html files?