How to prevent reloading of web page from cache while using mobile safari browser?

后端 未结 2 512
时光取名叫无心
时光取名叫无心 2021-01-05 13:36

Mobile Safari uses a special caching mechanism Page Cache (here) which basically keeps the current page alive but hibernated when we navigate to another page. T

2条回答
  •  有刺的猬
    2021-01-05 13:47

    Another potential solution is to look at the event.persisted flag to determine if it's cached or not:

    window.onpageshow = function(event) {
        if (event.persisted) {
            window.location.reload() 
        }
    };
    

提交回复
热议问题