--- title: PageTransitionEvent.persisted slug: Web/API/PageTransitionEvent/persisted translation_of: Web/API/PageTransitionEvent/persisted ---
{{APIRef("HTML DOM")}}

只读属性persisted代表一个页面是否从缓存中加载的

Syntax

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

Value

A {{jsxref("Boolean")}}.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', '#dom-pagetransitionevent-persisted', 'PageTransitionEvent: persisted')}} {{Spec2('HTML WHATWG')}} Initial definition

Browser compatibility

{{Compat("api.PageTransitionEvent.persisted")}}