PageSwapEvent: PageSwapEvent() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The PageSwapEvent() constructor creates a new PageSwapEvent object instance.

Syntax

js
new PageSwapEvent(type, init)

Parameters

type

A string representing the type of event. In the case of PageSwapEvent this is always pageswap.

init

An object containing the following properties:

activation

A NavigationActivation object representing the navigation type and current and destination document history entries. Defaults to null if the associated navigation is a cross-origin navigation.

viewTransition

A ViewTransition object representing the active view transition for the related navigation. Defaults to null if there is no active view transition.

Examples

A developer would not use this constructor manually. A new PageSwapEvent object is constructed when a handler is invoked as a result of the pageswap event firing.

Specifications

Specification
HTML
# the-pageswapevent-interface

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
PageSwapEvent() constructor
Chrome – Full support
Chrome 128 (Release date: 2024-08-20)
footnote Full support
Edge – Full support
Edge 128 (Release date: 2024-08-22)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 114 (Release date: 2024-09-25)
footnote Full support
Safari – Full support
Safari 18.2 (Release date: 2024-12-11)
footnote Full support
Chrome Android – Full support
Chrome Android 128 (Release date: 2024-08-20)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 85 (Release date: 2024-10-29)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 128 (Release date: 2024-08-20)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.2 (Release date: 2024-12-11)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also