If I set the item localStorage, then it StorageEventstarts for all windows with one domain except the current one.
If I bring up StorageEventprogrammatically, then it StorageEventonly starts for the target window.
Code example:
var evt = document.createEvent('StorageEvent');
evt.initStorageEvent('storage',false,false,'key','oldValue','newValue',
'http://example.com',window.localStorage);
window.dispatchEvent(evt);
Can I change the sample code for modeling behavior from window.setItem
source
share