html page is loaded from disk cache but event.persisted is false

209 views Asked by At

I have this to my javascript file:

window.addEventListener('pageshow', function(event) {
  if (event.persisted) {
    console.log('Page was loaded from cache.');
  }
});

but if i navigate to another link and then hit back button, my html page is loaded from disk cache and the event.persisted is false. Any suggestions?

1

There are 1 answers

0
lvanna9786 On

I think event.persisted indicates if a webpage is loading from "memory" cache. Not disk cache.