Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The PageRevealEvent
event object is made available inside handler functions for the pagereveal
event.
During a cross-document navigation, it allows you to manipulate a related view transition (providing access to the relevant ViewTransition
object) from the document being navigated to, if a view transition was triggered by the navigation.
Outside view transitions, this event is also useful for cases such as triggering a startup animation, or reporting a page view. It's equivalent to the first Window.requestAnimationFrame()
run after a cross-document navigation, if you were to trigger requestAnimationFrame()
in the <head>
of the document. For example, if you ran the following reveal()
function in the <head>
:
function reveal() { // Include startup animation here } /* This will fire in the first rendered frame after loading */ requestAnimationFrame(() => reveal()); /* This will fire if the page is restored from BFCache */ window.onpagehide = () => requestAnimationFrame(() => reveal());