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
open external val bubbles: Boolean
Link copied to clipboard
open external val cancelable: Boolean
Link copied to clipboard
open external val canIntercept: Boolean

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
open external val composed: Boolean
Link copied to clipboard
open external val currentTarget: EventTarget?
Link copied to clipboard
open external val defaultPrevented: Boolean
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
open external val downloadRequest: String?

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
open external val eventPhase: EventPhase
Link copied to clipboard
open external val formData: FormData?

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
open external val hashChange: Boolean

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
open external val hasUAVisualTransition: Boolean

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
open external 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
external val isTrusted: Boolean
Link copied to clipboard
open external val navigationType: NavigationType

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

Link copied to clipboard
open external val signal: AbortSignal

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

Link copied to clipboard
open external val sourceElement: Element?

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
open external val target: EventTarget?
Link copied to clipboard
open external val timeStamp: DOMHighResTimeStamp
Link copied to clipboard
open external override val type: EventType<NavigateEvent>
Link copied to clipboard
open external val userInitiated: Boolean

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
open external fun composedPath(): ReadonlyArray<EventTarget>
Link copied to clipboard
open external 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
open external fun preventDefault()
Link copied to clipboard
open external 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
open external fun stopImmediatePropagation()
Link copied to clipboard
open external fun stopPropagation()