Navigation


@WebNavigationClient.ExperimentalNavigationCallback
public 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 methods

abstract boolean

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

abstract boolean

Indicates whether the navigation committed an error page.

abstract @Nullable Page

Returns the Page that the navigation commits into.

abstract int

Returns the status code received by the navigation.

abstract boolean

Indicates whether the navigation is a history back navigation.

abstract boolean

Indicates whether the navigation is a history forward navigation.

abstract boolean

Indicates whether the navigation is a history navigation.

abstract boolean

Indicates whether the navigation is a reload navigation.

abstract boolean

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

abstract boolean

Indicates whether the navigation is a same-document navigation.

abstract 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 methods

didCommit

abstract boolean didCommit()

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

Returns
boolean

True if committed, false otherwise.

didCommitErrorPage

abstract boolean didCommitErrorPage()

Indicates whether the navigation committed an error page.

Returns
boolean

True if an error page was committed, false otherwise.

getPage

abstract @Nullable Page getPage()

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
@Nullable Page

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

getStatusCode

abstract int getStatusCode()

Returns the status code received by the navigation.

Returns
int

The HTTP status code.

isBack

abstract boolean isBack()

Indicates whether the navigation is a history back navigation.

Returns
boolean

True if back navigation, false otherwise.

isForward

abstract boolean isForward()

Indicates whether the navigation is a history forward navigation.

Returns
boolean

True if forward navigation, false otherwise.

isHistory

abstract boolean isHistory()

Indicates whether the navigation is a history navigation.

Returns
boolean

True if history, false otherwise.

isReload

abstract boolean isReload()

Indicates whether the navigation is a reload navigation.

Returns
boolean

True if reload, false otherwise.

isRestore

abstract boolean isRestore()

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

Returns
boolean

True if session restore, false otherwise.

isSameDocument

abstract boolean isSameDocument()

Indicates whether the navigation is a same-document navigation.

Returns
boolean

True if same-document, false otherwise.

wasInitiatedByPage

abstract boolean wasInitiatedByPage()

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.