PageTransitionEvent

The PageTransitionEvent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.

Properties

This interface also inherits properties from its parent, Event.

PageTransitionEvent.persisted Read only
Indicates if the document is loading from a cache.

Example

HTML

<!DOCTYPE html>
<html>
<body>
</body>
</html>

JavaScript

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");
  }
}

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'PageTransitionEvent' in that specification.
Living Standard Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
PageTransitionEventChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
persistedChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support 11
Notes
Full support 11
Notes
Notes The persisted property is known to be buggy in Internet Explorer. It is advised to check if window.performance.navigation.type == 2 as well.
Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support
See implementation notes.
See implementation notes.

See also