localStorage in win8.1 IE11 does not synchronize

前端 未结 4 1229
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-30 05:41

We have two pages \"/read\" and \"/write\". Page \"/write\" each second updates localStorage with current time:

setInterval(function(){
    var time = (new          


        
4条回答
  •  清酒与你
    2020-12-30 06:13

    I've found a workaround for this issue on Win 10. If you handle the window.onstorage event in your code then localStorage will refresh for all open tabs. Something as simple as this worked for me:

    window.onstorage = function(e){
        //Leave this empty
        //or add code to handle
        //the event
    };
    

    I haven't tested this code thoroughly, so please do so before using this method in any production apps.

    Hope this helps!

提交回复
热议问题