NavigateEvent

The NavigateEvent interface of the Navigation API is the event object for the navigate event, which fires when any type of navigation is initiated (this includes usage of History API features like History.go()). NavigateEvent provides access to information about that navigation, and allows developers to intercept and control the navigation handling.

MDN Reference

Constructors

Link copied to clipboard
constructor(type: EventType<NavigateEvent>, init: NavigateEventInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The canIntercept read-only property of the NavigateEvent interface returns true if the navigation can be intercepted and have its URL rewritten, or false otherwise

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The destination read-only property of the NavigateEvent interface returns a NavigationDestination object representing the destination being navigated to.

Link copied to clipboard

The downloadRequest read-only property of the NavigateEvent interface returns the filename of the file requested for download, in the case of a download navigation (e.g., an or element with a download attribute), or null otherwise.

Link copied to clipboard
Link copied to clipboard

The formData read-only property of the NavigateEvent interface returns the FormData object representing the submitted data in the case of a POST form submission, or null otherwise.

Link copied to clipboard

The hashChange read-only property of the NavigateEvent interface returns true if the navigation is a fragment navigation (i.e., to a fragment identifier in the same document), or false otherwise.

Link copied to clipboard

The hasUAVisualTransition read-only property of the NavigateEvent interface returns true if the user agent performed a visual transition for this navigation before dispatching this event, or false otherwise.

Link copied to clipboard
val info: JsAny?

The info read-only property of the NavigateEvent interface returns the info data value passed by the initiating navigation operation (e.g., Navigation.back(), or Navigation.navigate()), or undefined if no info data was passed.

Link copied to clipboard
Link copied to clipboard

The navigationType read-only property of the NavigateEvent interface returns the type of the navigation — push, reload, replace, or traverse.

Link copied to clipboard
Link copied to clipboard

The signal read-only property of the NavigateEvent interface returns an AbortSignal, which will become aborted if the navigation is cancelled (e.g., by the user pressing the browser's "Stop" button, or another navigation starting and thus cancelling the ongoing one).

Link copied to clipboard

The sourceElement read-only property of the NavigateEvent interface returns an Element object representing the initiating element, in cases where the navigation was initiated by an element.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val type: EventType<NavigateEvent>
Link copied to clipboard

The userInitiated read-only property of the NavigateEvent interface returns true if the navigation was initiated by the user (e.g., by clicking a link, submitting a form, or pressing the browser's "Back"/"Forward" buttons), or false otherwise.

Functions

Link copied to clipboard
Link copied to clipboard
fun intercept(options: NavigationInterceptOptions = definedExternally)

The intercept() method of the NavigateEvent interface intercepts this navigation, turning it into a same-document navigation to the destination URL.

Link copied to clipboard
Link copied to clipboard
fun scroll()

The scroll() method of the NavigateEvent interface can be called to manually trigger the browser-driven scrolling behavior that occurs in response to the navigation, if you want it to happen before the navigation handling has completed.

Link copied to clipboard
Link copied to clipboard