We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

The pageshow event is fired when a session history entry is being traversed to. (This includes back/forward as well as initial page-showing after the onload event.)

General info

Document (dispatched on Window)
Default Action


Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not.
cancelable Read only Boolean Whether the event is cancellable or not.
persisted Read only boolean Persisted user state.


The following will log info about the pageshow event, which is fired on back/forward, not just after onload:

window.addEventListener('pageshow', function(event) {

While not best-practice, you can also add the event as an attribute on the body tag, same as onload:

<body onload="myonload()" onpageshow="mypageshowcode()">

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 4 (Yes) 1.5 (1.8) 11 15 5
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 2.3 (Yes) ? 11 35 5.1

Document Tags and Contributors

 Last updated by: fscholz,