Page transition events fire when a webpage is being loaded or unloaded.
<!DOCTYPE html> <html> <body onpageshow="myFunction(event)"> </body> </html>
function myFunction(event) {
if (event.persisted) {
alert("The page was cached by the browser");
} else {
alert("The page was NOT cached by the browser");
}
}
The PageTransitionEvent object has these types of members:
The PageTransitionEvent object has these properties.
| Property | Access type | Description |
|---|---|---|
| persisted | Read-only | Indicates if a webpage is loading from a cache. |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent