# NavigationParameters.Builder

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

*** ** * ** ***


```
class NavigationParameters.Builder
```

<br />

*** ** * ** ***

A Builder for `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#Builder()()` Constructor for NavigationParameters builder which sets parameter defaults. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#addAdditionalHeader(java.lang.String,java.lang.String)(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Adds an additional HTTP header to the request. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#addAdditionalHeaders(java.util.Map<java.lang.String,java.lang.String>)(additionalHeaders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>)` Adds multiple additional HTTP headers to the request, as if `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#addAdditionalHeader(java.lang.String,java.lang.String)` were called multiple times with each key-value pair of the map. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.WEBVIEW_NAVIGATE_EXPERIMENTAL_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#build()()` Use to finish building the NavigationParameters. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#setShouldReplaceCurrentEntry(boolean)(shouldReplaceCurrentEntry: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` If true, the navigation will replace the current entry in the WebView's history, meaning that the current entry will not be reachable through WebView#goBack. |

## Public constructors

### Builder

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

```
Builder()
```

Constructor for NavigationParameters builder which sets parameter defaults.

## Public functions

### addAdditionalHeader

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

```
fun addAdditionalHeader(key: String, value: String): NavigationParameters.Builder
```

Adds an additional HTTP header to the request. Note that if the header is set by default by this WebView, such as those controlling caching, accept types or the User-Agent, it may be overridden by this WebView's default.

Unlike headers passed to `https://developer.android.com/reference/android/webkit/WebView.html#loadUrl(java.lang.String, java.util.Map&lt;java.lang.String,java.lang.String&gt;)`, additional headers passed here are tied to the navigation, meaning that subsequent user triggered navigations to the same URL will not have those headers applied. If called multiple times for the same key, the latest value will be used.

Header keys must be RFC 2616-compliant.

### addAdditionalHeaders

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

```
fun addAdditionalHeaders(additionalHeaders: (Mutable)Map<String!, String!>): NavigationParameters.Builder
```

Adds multiple additional HTTP headers to the request, as if `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#addAdditionalHeader(java.lang.String,java.lang.String)` were called multiple times with each key-value pair of the map. See `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters.Builder#addAdditionalHeader(java.lang.String,java.lang.String)` for more information.

### build

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

```
@RequiresFeature(name = WebViewFeature.WEBVIEW_NAVIGATE_EXPERIMENTAL_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun build(): NavigationParameters
```

Use to finish building the NavigationParameters.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/NavigationParameters` | built NavigationParameters object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#WEBVIEW_NAVIGATE_EXPERIMENTAL_V1()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### setShouldReplaceCurrentEntry

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

```
fun setShouldReplaceCurrentEntry(shouldReplaceCurrentEntry: Boolean): NavigationParameters.Builder
```

If true, the navigation will replace the current entry in the WebView's history, meaning that the current entry will not be reachable through WebView#goBack. Defaults to `false`.