一,当安卓和ios都有问题的时候
// a.html 设置刷新 检测缓存是否有标志 要是有就说明数据有变化 a.html跳转到b.html页面
window.addEventListener("pageshow", function(){
if(sessionStorage.getItem("need-refresh")){
location.reload();
sessionStorage.removeItem("need-refresh");
}
});
// b.html 如果是数据变化了就写一条缓存 b.html返回到a.html页面
sessionStorage.setItem("need-refresh", true);
二、当只有ios端有问题的时候
$(function() {
var isPageHide = false;
window.addEventListener('pageshow', function() {
if(isPageHide) {
window.location.reload();
}
});
window.addEventListener('pagehide', function() {
isPageHide = true;
});
})
参考地址:https://www.cnblogs.com/wangmaoling/p/8022561.html
日常所遇,随手而记。
浙公网安备 33010602011771号