# NavigationListener

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/NavigationListener.java+class:androidx.webkit.NavigationListener) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

*** ** * ** ***


```
interface NavigationListener
```

<br />

*** ** * ** ***

Page identification and lifecycle APIs.

This class provides callbacks to identify the different stages of navigation. For more information about the navigation lifecycle, please see the [Life of a Navigation Presentation](https://docs.google.com/presentation/d/1YVqDmbXI0cllpfXD7TuewiexDNZYfwk6fRdmoXJbBlM).

Note: These navigation callbacks only fire for navigations happening on the main frame.

Navigation lifecycle events:

- `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.Navigation)`
- Potentially zero or more `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.Navigation)` events
- `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.Navigation)`
- If the navigation commits and is not a same-document navigation, potentially any combination and order of zero or one of each of:
  - `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.Page)`
  - `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.Page)`
  - `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.Page,long)`
  - `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.Page,long)`
  - `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.Page,java.lang.String,long)`

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#CLASS) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = [https://developer.android.com/reference/java/lang/annotation/ElementType.html#METHOD, https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE, https://developer.android.com/reference/java/lang/annotation/ElementType.html#FIELD]) @https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn(level = https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn.Level#ERROR) annotation https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener.ExperimentalOnNavigationVisible` Denotes that the onNavigationVisible callback is experimental. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onFirstContentfulPaintMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.Page,long))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.PageState,long)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.PageState,long)(pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called when the page achieves "First Contentful Paint". |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onLargestContentfulPaintMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.Page,long))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.PageState,long)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.PageState,long)( pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Called when the page fires a "Largest Contentful Paint" event. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onNavigationCompleted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.Navigation))(navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.NavigationState)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.NavigationState)(navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState)` Called when a navigation completes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onNavigationRedirected](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.Navigation))(navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.NavigationState,androidx.webkit.NavigationRedirectParameters)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.NavigationState,androidx.webkit.NavigationRedirectParameters)( navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState, navigationRedirectParameters: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationRedirectParameters )` Called when a navigation is redirected. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onNavigationStarted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.Navigation))(navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.NavigationState)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.NavigationState)(navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState)` Called when a navigation starts, including same-document navigations. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener.ExperimentalOnNavigationVisible https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationVisible(androidx.webkit.NavigationState)(navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState)` Called when a navigation is made visible |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onPageDeleted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDeleted(androidx.webkit.Page))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDeleted(androidx.webkit.PageState)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDeleted(androidx.webkit.PageState)(pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState)` Called when any Page is evicted/destroyed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onPageDomContentLoadedEvent](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.Page))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.PageState)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.PageState)(pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState)` Called when the `DOMContentLoaded` event is fired for the current page. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onPageLoadEvent](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.Page))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.PageState)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.PageState)(pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState)` Called when the `window.load` event is fired for the current page. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onPerformanceMarkMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.Page,java.lang.String,long))(page: https://developer.android.com/reference/kotlin/androidx/webkit/Page, markName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, markTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.PageState,java.lang.String,long)` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.PageState,java.lang.String,long)( pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState, markName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, markTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Called when the page registers a performance mark. |

## Public functions

### onFirstContentfulPaintMillis

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.16.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onFirstContentfulPaintMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.Page,long))(page: Page, durationMillis: Long): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onFirstContentfulPaintMillis(androidx.webkit.PageState,long)` instead.

Called when the page achieves "First Contentful Paint".

See [First Contentful Paint (FCP)](https://web.dev/articles/fcp) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page for which the First Contentful Paint occurred. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Navigation to First Contentful Paint duration in milliseconds. |

### onFirstContentfulPaintMillis

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onFirstContentfulPaintMillis(pageState: PageState, durationMillis: Long): Unit
```

Called when the page achieves "First Contentful Paint".

See [First Contentful Paint (FCP)](https://web.dev/articles/fcp) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | The Page's state at which the First Contentful Paint occurred. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Navigation to First Contentful Paint duration in milliseconds. |

### onLargestContentfulPaintMillis

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.16.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onLargestContentfulPaintMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.Page,long))(page: Page, durationMillis: Long): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onLargestContentfulPaintMillis(androidx.webkit.PageState,long)` instead.

Called when the page fires a "Largest Contentful Paint" event.

See [Largest Contentful Paint (LCP)](https://web.dev/articles/lcp) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page for which the Largest Contentful Paint occurred. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Navigation to Largest Contentful Paint duration in milliseconds. |

### onLargestContentfulPaintMillis

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onLargestContentfulPaintMillis(
    pageState: PageState,
    durationMillis: Long
): Unit
```

Called when the page fires a "Largest Contentful Paint" event.

See [Largest Contentful Paint (LCP)](https://web.dev/articles/lcp) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | The Page's state at which the Largest Contentful Paint occurred. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Navigation to Largest Contentful Paint duration in milliseconds. |

### onNavigationCompleted

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onNavigationCompleted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.Navigation))(navigation: Navigation): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationCompleted(androidx.webkit.NavigationState)` instead.

Called when a navigation completes.

The navigation might not have actually committed (e.g., results in 204/download/cancelled), but those that do they will have committed by this point.

| Parameters |
|---|---|
| `navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation` | The Navigation object representing the completed navigation. |

### onNavigationCompleted

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onNavigationCompleted(navigationState: NavigationState): Unit
```

Called when a navigation completes.

The navigation might not have actually committed (e.g., results in 204/download/cancelled), but those that do they will have committed by this point.

| Parameters |
|---|---|
| `navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState` | An immutable snapshot of the Navigation's state at the point the Navigation is completed. |

### onNavigationRedirected

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onNavigationRedirected](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.Navigation))(navigation: Navigation): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationRedirected(androidx.webkit.NavigationState,androidx.webkit.NavigationRedirectParameters)` instead.

Called when a navigation is redirected.

| Parameters |
|---|---|
| `navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation` | The Navigation object representing the redirected navigation. |

### onNavigationRedirected

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onNavigationRedirected(
    navigationState: NavigationState,
    navigationRedirectParameters: NavigationRedirectParameters
): Unit
```

Called when a navigation is redirected.

| Parameters |
|---|---|
| `navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState` | An immutable snapshot of the Navigation's state at the point the Navigation is redirected. |
| `navigationRedirectParameters: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationRedirectParameters` | An object which exposes response headers for the callback |

### onNavigationStarted

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onNavigationStarted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.Navigation))(navigation: Navigation): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.NavigationState)` instead.

Called when a navigation starts, including same-document navigations.

Note: These navigation callbacks only fire for navigations happening on the main frame.

| Parameters |
|---|---|
| `navigation: https://developer.android.com/reference/kotlin/androidx/webkit/Navigation` | The Navigation object representing the started navigation. |

### onNavigationStarted

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onNavigationStarted(navigationState: NavigationState): Unit
```

Called when a navigation starts, including same-document navigations.

Note: These navigation callbacks only fire for navigations happening on the main frame.

Note: Calling super will call the old `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onNavigationStarted(androidx.webkit.Navigation)`

| Parameters |
|---|---|
| `navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState` | An immutable snapshot of the Navigation's state at the point when the Navigation is started. |

### onNavigationVisible

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
@NavigationListener.ExperimentalOnNavigationVisible
fun onNavigationVisible(navigationState: NavigationState): Unit
```

Called when a navigation is made visible

Note: This method is only called if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER_NAVIGATION_VISIBLE()` is supported.

| Parameters |
|---|---|
| `navigationState: https://developer.android.com/reference/kotlin/androidx/webkit/NavigationState` | An immutable snapshot of the Navigation's state at the point the Navigation is visible. |

### onPageDeleted

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onPageDeleted](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDeleted(androidx.webkit.Page))(page: Page): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDeleted(androidx.webkit.PageState)` instead.

Called when any Page is evicted/destroyed. This can occur immediately on navigation, or later if the page is BFCached and subsequently evicted.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page that was evicted or destroyed. |

### onPageDeleted

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onPageDeleted(pageState: PageState): Unit
```

Called when any Page is evicted/destroyed. This can occur immediately on navigation, or later if the page is BFCached and subsequently evicted.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | An immutable snapshot of the Page's state at the point the Page is deleted. |

### onPageDomContentLoadedEvent

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onPageDomContentLoadedEvent](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.Page))(page: Page): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageDomContentLoadedEvent(androidx.webkit.PageState)` instead.

Called when the `DOMContentLoaded` event is fired for the current page.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page for which the `DOMContentLoaded` event fired. |

### onPageDomContentLoadedEvent

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onPageDomContentLoadedEvent(pageState: PageState): Unit
```

Called when the `DOMContentLoaded` event is fired for the current page.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | An immutable snapshot of the Page's state at the point the DOMContentLoaded event is fired. |

### onPageLoadEvent

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onPageLoadEvent](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.Page))(page: Page): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPageLoadEvent(androidx.webkit.PageState)` instead.

Called when the `window.load` event is fired for the current page.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page for which the `window.load` event fired. |

### onPageLoadEvent

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onPageLoadEvent(pageState: PageState): Unit
```

Called when the `window.load` event is fired for the current page.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | An immutable snapshot of the Page's state at the point the Page is loaded. |

### onPerformanceMarkMillis

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.16.0) Deprecated in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun [onPerformanceMarkMillis](https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.Page,java.lang.String,long))(page: Page, markName: String, markTimeMillis: Long): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationListener#onPerformanceMarkMillis(androidx.webkit.PageState,java.lang.String,long)` instead.

Called when the page registers a performance mark.

See [Performance: mark() method](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `page: https://developer.android.com/reference/kotlin/androidx/webkit/Page` | The Page for which the performance mark was registered. |
| `markName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the performance mark. |
| `markTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time of the performance mark in milliseconds since Performance.timeOrigin. |

### onPerformanceMarkMillis

Added in [1.19.0-alpha01](https://developer.android.com/jetpack/androidx/releases/webkit#1.19.0-alpha01)

```
fun onPerformanceMarkMillis(
    pageState: PageState,
    markName: String,
    markTimeMillis: Long
): Unit
```

Called when the page registers a performance mark.

See [Performance: mark() method](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) for a definition.
Note: Delivery of this event may be delayed due to batching with other events, so it may not be sent in real-time.

This method is called only if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#NAVIGATION_LISTENER()` is supported. You can check whether that flag is supported using `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`.

| Parameters |
|---|---|
| `pageState: https://developer.android.com/reference/kotlin/androidx/webkit/PageState` | The Page's state at which the performance mark was registered. |
| `markName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the performance mark. |
| `markTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time of the performance mark in milliseconds since Performance.timeOrigin. |