Navigation


@WebNavigationClient.ExperimentalNavigationCallback
interface Navigation


The Navigation instance passed by the navigation callbacks.

The same object will be used by the relevant callbacks for the same navigation, allowing the instance itself to be used as a key/ID to connect the callbacks for the same navigations.

Summary

Public functions

Boolean

Indicates whether the navigation committed (i.e., did not get aborted/return 204/etc).

Boolean

Indicates whether the navigation committed an error page.

Page?

Returns the Page that the navigation commits into.

Int

Returns the status code received by the navigation.

Boolean

Indicates whether the navigation is a history back navigation.

Boolean

Indicates whether the navigation is a history forward navigation.

Boolean

Indicates whether the navigation is a history navigation.

Boolean

Indicates whether the navigation is a reload navigation.

Boolean

Indicates whether the navigation is a restore navigation after calling restoreState.

Boolean

Indicates whether the navigation is a same-document navigation.

Boolean

Indicates whether the navigation is initiated by the page/renderer (e.g., link clicks, JS script) instead of the browser/app (e.g., loadUrl calls).

Public functions

didCommit

fun didCommit(): Boolean

Indicates whether the navigation committed (i.e., did not get aborted/return 204/etc).

Returns
Boolean

True if committed, false otherwise.

didCommitErrorPage

fun didCommitErrorPage(): Boolean

Indicates whether the navigation committed an error page.

Returns
Boolean

True if an error page was committed, false otherwise.

getPage

fun getPage(): Page?

Returns the Page that the navigation commits into.

Note: This method will initially return null when navigation begins. If the navigation successfully commits a page, this method will return the corresponding Page object. This could be a newly created Page or a previously seen Page in the case of BFCache (Back/Forward Cache).

Note: Once this method returns a non-null Page object for a specific navigation, it will always return the same Page object for that navigation.

Returns
Page?

The Page object, or null if the navigation does not commit or result in a Page (e.g., 204/download).

getStatusCode

fun getStatusCode(): Int

Returns the status code received by the navigation.

Returns
Int

The HTTP status code.

isBack

fun isBack(): Boolean

Indicates whether the navigation is a history back navigation.

Returns
Boolean

True if back navigation, false otherwise.

isForward

fun isForward(): Boolean

Indicates whether the navigation is a history forward navigation.

Returns
Boolean

True if forward navigation, false otherwise.

isHistory

fun isHistory(): Boolean

Indicates whether the navigation is a history navigation.

Returns
Boolean

True if history, false otherwise.

isReload

fun isReload(): Boolean

Indicates whether the navigation is a reload navigation.

Returns
Boolean

True if reload, false otherwise.

isRestore

fun isRestore(): Boolean

Indicates whether the navigation is a restore navigation after calling restoreState.

Returns
Boolean

True if session restore, false otherwise.

isSameDocument

fun isSameDocument(): Boolean

Indicates whether the navigation is a same-document navigation.

Returns
Boolean

True if same-document, false otherwise.

wasInitiatedByPage

fun wasInitiatedByPage(): Boolean

Indicates whether the navigation is initiated by the page/renderer (e.g., link clicks, JS script) instead of the browser/app (e.g., loadUrl calls).

Returns
Boolean

True if page-initiated, false otherwise.