简体   繁体   中英

Listen for localStorage.setItem on same Window (FireFox & IE)

I found this thread that answers partially:

Listen for changes with localStorage on the same window

Although it works in Chrome, I still wasn't able to figure out how to work on Firefox or IE.

Storage interface emits storage event on global objects which it affects.

window.addEventListener("storage", function () {
    // your code
}, false);

this event will also be triggered when you use setItem .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM