📌  相关文章
📜  JS如何判断页面是否被缓存 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:19.241000             🧑  作者: Mango

代码示例1
// https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent
window.addEventListener('pageshow', myFunction);

function myFunction(event) { 
  if (event.persisted) {
    alert("The page was cached by the browser");
  } else {
    alert("The page was NOT cached by the browser");
  }
}