# WebSettingsCompat

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

*** ** * ** ***


```
class WebSettingsCompat
```

<br />

*** ** * ** ***

Compatibility version of `https://developer.android.com/reference/android/webkit/WebSettings.html`

## 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#FIELD, https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE]) @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/WebSettingsCompat.ExperimentalBackForwardCacheSettings` Denotes that the SpeculativeLoading API surface is experimental. |
| `@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#FIELD, https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE]) @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/WebSettingsCompat.ExperimentalSpeculativeLoading` Denotes that the SpeculativeLoading API surface is experimental. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER() = 3` **This property is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER() = 1` **This property is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED() = 0` **This property is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER() = 2` **This property is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING() = 2` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_USER_AGENT_DARKENING_ONLY() = 0` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_WEB_THEME_DARKENING_ONLY() = 1` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_AUTO() = 1` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_OFF() = 0` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_ON() = 2` **This property is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_DISABLED() = 0` Used to disable the hyperlink context menu, preventing it from showing when the user long presses on a hyperlink. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_ADDRESS() = 1` Enable the "Copy link address" menu item which, when clicked, copies the URL of the selected hyperlink to the clipboard. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT() = 2` Enable the "Copy link text" menu item which, when clicked, copies the text of the selected hyperlink to the clipboard. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK() = 4` Enable the "Open link" menu item which, when clicked, opens the selected hyperlink in the default browser. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#SPECULATIVE_LOADING_DISABLED() = 0` Disables all speculative loading tech. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#SPECULATIVE_LOADING_PRERENDER_ENABLED() = 1` Enabled Prerender for this WebSettings, See [Prerender](https://developer.chrome.com/docs/web-platform/prerender-pages) to learn more. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_APP() = 1` The support level that allows WebAuthn requests for the app in which the WebView is embedded. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER() = 2` The support level that allows apps to make WebAuthn calls for any website. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE() = 0` The support level that disables WebAuthn requests from WebView. |

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.COOKIE_INTERCEPT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#areCookiesIncludedInShouldInterceptRequest(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Returns whether cookie access during request intercept is enabled. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ATTRIBUTION_REGISTRATION_BEHAVIOR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [getAttributionRegistrationBehavior](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getAttributionRegistrationBehavior(android.webkit.WebSettings))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` **This function is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.BACK_FORWARD_CACHE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getBackForwardCacheEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get the current status of BackForwardCache for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/webkit/BackForwardCacheSettings` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.BACK_FORWARD_CACHE_SETTINGS_EXPERIMENTAL_V3, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") @https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.ExperimentalBackForwardCacheSettings https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getBackForwardCacheSettings(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get the current `https://developer.android.com/reference/kotlin/androidx/webkit/BackForwardCacheSettings` for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getDisabledActionModeMenuItems(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Gets the action mode menu items that are disabled, expressed in an integer field flag. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.DOWNLOAD_FAVICONS_ENABLED, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getDownloadFaviconsEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Returns whether the WebView will download a Favicon upon navigation. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getEnterpriseAuthenticationAppLinkPolicyEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Gets whether EnterpriseAuthenticationAppLinkPolicy is allowed to have any effect on WebView. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.FORCE_DARK, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [getForceDark](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDark(android.webkit.WebSettings))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` **This function is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.FORCE_DARK_STRATEGY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [getForceDarkStrategy](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDarkStrategy(android.webkit.WebSettings))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` **This function is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getHasEnrolledInstrumentEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get the current status of `hasEnrolledInstrument()` method in [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.OFF_SCREEN_PRERASTER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getOffscreenPreRaster(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Gets whether this WebView should raster tiles when it is offscreen but attached to a window. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getPaymentRequestEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get the current status of [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [getRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getRequestedWithHeaderOriginAllowList(android.webkit.WebSettings))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` **This function is deprecated.** The origin trial to disable the X-Requested-With feature has ended, so this API now just returns an empty set. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.SAFE_BROWSING_ENABLE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getSafeBrowsingEnabled(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Gets whether Safe Browsing is enabled. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.SPECULATIVE_LOADING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") @https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getSpeculativeLoadingStatus(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Gets speculative loading status for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/webkit/UserAgentMetadata` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.USER_AGENT_METADATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getUserAgentMetadata(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get the WebView's user-agent metadata which used to generate user-agent client hints. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.WEB_AUTHENTICATION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") @https://developer.android.com/reference/kotlin/androidx/annotation/UiThread https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getWebAuthenticationSupport(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Returns the support level for the given `https://developer.android.com/reference/android/webkit/WebSettings.html` |
| `java-static https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.WEBVIEW_MEDIA_INTEGRITY_API_STATUS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getWebViewMediaIntegrityApiStatus(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Returns the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig` currently in use. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ALGORITHMIC_DARKENING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#isAlgorithmicDarkeningAllowed(android.webkit.WebSettings)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html)` Get if algorithmic darkening is allowed or not for this WebView. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ALGORITHMIC_DARKENING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, allow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Control whether algorithmic darkening is allowed. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ATTRIBUTION_REGISTRATION_BEHAVIOR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [setAttributionRegistrationBehavior](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAttributionRegistrationBehavior(android.webkit.WebSettings,int))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, behavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.BACK_FORWARD_CACHE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setBackForwardCacheEnabled(android.webkit.WebSettings,boolean)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, backForwardCacheEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Enables [BackForwardCache](https://developer.chrome.com/blog/back-forward-cache) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.COOKIE_INTERCEPT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setCookiesIncludedInShouldInterceptRequest(android.webkit.WebSettings,boolean)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` This method controls if the relevant `Cookie` header will be added to the `https://developer.android.com/reference/android/webkit/WebResourceRequest.html` object passed to `https://developer.android.com/reference/android/webkit/WebViewClient.html#shouldInterceptRequest(android.webkit.WebView, android.webkit.WebResourceRequest)`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setDisabledActionModeMenuItems(android.webkit.WebSettings,int)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, menuItems: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Disables the action mode menu items according to `menuItems` flag. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.DOWNLOAD_FAVICONS_ENABLED, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setDownloadFaviconsEnabled(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the WebView will download a Favicon upon navigation. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setEnterpriseAuthenticationAppLinkPolicyEnabled(android.webkit.WebSettings,boolean)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Sets whether EnterpriseAuthenticationAppLinkPolicy if set by admin is allowed to have any effect on WebView. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.FORCE_DARK, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [setForceDark](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, forceDarkMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** The "force dark" model previously implemented by WebView was complex and didn't interoperate well with current Web standards for `prefers-color-scheme` and `color-scheme`. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.FORCE_DARK_STRATEGY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [setForceDarkStrategy](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int))(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, forceDarkBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setHasEnrolledInstrumentEnabled(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Enables support for `hasEnrolledInstrument()` method in [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.HYPERLINK_CONTEXT_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setHyperlinkContextMenuItems(android.webkit.WebSettings,int)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, hyperlinkMenuItems: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Sets which items appear in the context menu when a user long-presses a hyperlink. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.OFF_SCREEN_PRERASTER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setOffscreenPreRaster(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether this WebView should raster tiles when it is offscreen but attached to a window. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setPaymentRequestEnabled(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Enables [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") [setRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setRequestedWithHeaderOriginAllowList(android.webkit.WebSettings,java.util.Set<java.lang.String>))( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, allowList: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!> )` **This function is deprecated.** The origin trial to disable the X-Requested-With feature has ended, so this API no longer does anything. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.SAFE_BROWSING_ENABLE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setSafeBrowsingEnabled(android.webkit.WebSettings,boolean)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether Safe Browsing is enabled. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.SPECULATIVE_LOADING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") @https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setSpeculativeLoadingStatus(android.webkit.WebSettings,int)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, speculativeLoadingStatus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Sets whether speculative loading status for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.USER_AGENT_METADATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setUserAgentMetadata(android.webkit.WebSettings,androidx.webkit.UserAgentMetadata)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, metadata: https://developer.android.com/reference/kotlin/androidx/webkit/UserAgentMetadata)` Sets the WebView's user-agent metadata to generate user-agent client hints. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.WEB_AUTHENTICATION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") @https://developer.android.com/reference/kotlin/androidx/annotation/UiThread https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setWebAuthenticationSupport(android.webkit.WebSettings,int)(settings: https://developer.android.com/reference/android/webkit/WebSettings.html, support: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the support level for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.WEBVIEW_MEDIA_INTEGRITY_API_STATUS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setWebViewMediaIntegrityApiStatus(android.webkit.WebSettings,androidx.webkit.WebViewMediaIntegrityApiStatusConfig)( settings: https://developer.android.com/reference/android/webkit/WebSettings.html, permissionConfig: https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig )` Sets permissions provided through `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig` for using the WebView Integrity API. |

## Constants

### ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER

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

```
const val ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER = 3: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

AttributionRegistrationBehavior that allows apps to register app sources and app triggers from WebView.

### ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER

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

```
const val ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

AttributionRegistrationBehavior that allows apps to register app sources (sources associated with the app package name) and web triggers (triggers associated with the eTLD+1) from WebView.

This is the default behavior.

### ATTRIBUTION_BEHAVIOR_DISABLED

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

```
const val ATTRIBUTION_BEHAVIOR_DISABLED = 0: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

AttributionRegistrationBehavior that disables source and trigger registration from WebView.

Note that the initial network call to the Attribution Source or Trigger URIs may still happen depending on the installed version of WebView, but any response is discarded and nothing will be stored on the device.

### ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER

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

```
const val ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

AttributionRegistrationBehavior that allows apps to register web sources and web triggers from WebView.

This option should only be used after applying to [use web sources](https://developer.android.com/design-for-safety/privacy-sandbox/attribution-app-to-web#register-attribution).

### DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING

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

```
const val DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

In this mode WebView content will be darkened by a user agent unless web page supports dark theme. WebView determines whether web pages supports dark theme by the presence of `color-scheme` metadata containing "dark" value. For example, `<meta name="color-scheme" content="dark light">`. If the metadata is not presented WebView content will be darkened by a user agent and `prefers-color-scheme` media query will evaluate to light.

See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int)` |   |

### DARK_STRATEGY_USER_AGENT_DARKENING_ONLY

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

```
const val DARK_STRATEGY_USER_AGENT_DARKENING_ONLY = 0: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

In this mode WebView content will be darkened by a user agent and it will ignore the web page's dark theme if it exists. To avoid mixing two different darkening strategies, the `prefers-color-scheme` media query will evaluate to light.

See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int)` |   |

### DARK_STRATEGY_WEB_THEME_DARKENING_ONLY

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

```
const val DARK_STRATEGY_WEB_THEME_DARKENING_ONLY = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

In this mode WebView content will always be darkened using dark theme provided by web page. If web page does not provide dark theme support WebView content will be rendered with a default theme.

See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int)` |   |

### FORCE_DARK_AUTO

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

```
const val FORCE_DARK_AUTO = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Enable force dark dependent on the state of the WebView parent view. If the WebView parent view is being automatically force darkened (@see android.view.View#setForceDarkAllowed), then WebView content will be rendered so as to emulate a dark theme. WebViews that are not attached to the view hierarchy will not be inverted.

If your app uses a dark theme, WebView will not be inverted. Similarly, if your app's theme inherits from a `DayNight` theme, WebView will not be inverted. In either of these cases, you should control the mode manually with `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_ON()` or `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_OFF()`.

See [Force Dark documentation](https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#force_dark) for more information.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` |   |

### FORCE_DARK_OFF

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

```
const val FORCE_DARK_OFF = 0: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Disable force dark, irrespective of the force dark mode of the WebView parent. In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` |   |

### FORCE_DARK_ON

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

```
const val FORCE_DARK_ON = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` |   |

### HYPERLINK_CONTEXT_MENU_DISABLED

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

```
const val HYPERLINK_CONTEXT_MENU_DISABLED = 0: Int
```

Used to disable the hyperlink context menu, preventing it from showing when the user long presses on a hyperlink. This is the default state.

### HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_ADDRESS

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

```
const val HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_ADDRESS = 1: Int
```

Enable the "Copy link address" menu item which, when clicked, copies the URL of the selected hyperlink to the clipboard.

### HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT

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

```
const val HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT = 2: Int
```

Enable the "Copy link text" menu item which, when clicked, copies the text of the selected hyperlink to the clipboard.

### HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK

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

```
const val HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK = 4: Int
```

Enable the "Open link" menu item which, when clicked, opens the selected hyperlink in the default browser.

### SPECULATIVE_LOADING_DISABLED

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

```
@WebSettingsCompat.ExperimentalSpeculativeLoading
const val SPECULATIVE_LOADING_DISABLED = 0: Int
```

Disables all speculative loading tech. See [this](https://developer.mozilla.org/en-US/docs/Web/Performance/Speculative_loading) to learn more.

This is the default behavior.

### SPECULATIVE_LOADING_PRERENDER_ENABLED

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

```
@WebSettingsCompat.ExperimentalSpeculativeLoading
const val SPECULATIVE_LOADING_PRERENDER_ENABLED = 1: Int
```

Enabled Prerender for this WebSettings, See [Prerender](https://developer.chrome.com/docs/web-platform/prerender-pages) to learn more.

### WEB_AUTHENTICATION_SUPPORT_FOR_APP

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

```
const val WEB_AUTHENTICATION_SUPPORT_FOR_APP = 1: Int
```

The support level that allows WebAuthn requests for the app in which the WebView is embedded. See [Digital Asset Links](https://developers.google.com/digital-asset-links) to learn how to associate an app with a website.

### WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER

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

```
const val WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER = 2: Int
```

The support level that allows apps to make WebAuthn calls for any website. See [Privileged apps](https://developer.android.com/training/sign-in/privileged-apps) to learn how to make WebAuthn calls for any website.

### WEB_AUTHENTICATION_SUPPORT_NONE

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

```
const val WEB_AUTHENTICATION_SUPPORT_NONE = 0: Int
```

The support level that disables WebAuthn requests from WebView.

This is the default behavior.

## Public functions

### areCookiesIncludedInShouldInterceptRequest

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

```
@RequiresFeature(name = WebViewFeature.COOKIE_INTERCEPT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun areCookiesIncludedInShouldInterceptRequest(settings: WebSettings): Boolean
```

Returns whether cookie access during request intercept is enabled.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setCookiesIncludedInShouldInterceptRequest(android.webkit.WebSettings,boolean)` |   |

### getAttributionRegistrationBehavior

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

```
@RequiresFeature(name = WebViewFeature.ATTRIBUTION_REGISTRATION_BEHAVIOR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [getAttributionRegistrationBehavior](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getAttributionRegistrationBehavior(android.webkit.WebSettings))(settings: WebSettings): Int
```

> [!CAUTION]
> **This function is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

Read the current behavior for attribution registration.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAttributionRegistrationBehavior(android.webkit.WebSettings,int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER()` |   |

### getBackForwardCacheEnabled

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

```
@RequiresFeature(name = WebViewFeature.BACK_FORWARD_CACHE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getBackForwardCacheEnabled(settings: WebSettings): Boolean
```

Get the current status of BackForwardCache for this `https://developer.android.com/reference/android/webkit/WebSettings.html`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether BackForwardCache is enabled or not. |

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

### getBackForwardCacheSettings

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

```
@RequiresFeature(name = WebViewFeature.BACK_FORWARD_CACHE_SETTINGS_EXPERIMENTAL_V3, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@WebSettingsCompat.ExperimentalBackForwardCacheSettings
java-static fun getBackForwardCacheSettings(settings: WebSettings): BackForwardCacheSettings
```

Get the current `https://developer.android.com/reference/kotlin/androidx/webkit/BackForwardCacheSettings` for this `https://developer.android.com/reference/android/webkit/WebSettings.html`.

The returned `https://developer.android.com/reference/kotlin/androidx/webkit/BackForwardCacheSettings` object is live; updates to it will be applied to the `https://developer.android.com/reference/android/webkit/WebSettings.html` immediately.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/BackForwardCacheSettings` | The current settings for the BackForwardCache. |

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

### getDisabledActionModeMenuItems

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

```
@RequiresFeature(name = WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getDisabledActionModeMenuItems(settings: WebSettings): Int
```

Gets the action mode menu items that are disabled, expressed in an integer field flag. The default value is `https://developer.android.com/reference/android/webkit/WebSettings.html#MENU_ITEM_NONE`

Value is either `0` or a combination of the following:

- `WebSettings.MENU_ITEM_NONE`
- `WebSettings.MENU_ITEM_SHARE`
- `WebSettings.MENU_ITEM_WEB_SEARCH`
- `WebSettings.MENU_ITEM_PROCESS_TEXT`

<br />

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | all the disabled menu item flags combined with bitwise OR. |

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

### getDownloadFaviconsEnabled

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

```
@RequiresFeature(name = WebViewFeature.DOWNLOAD_FAVICONS_ENABLED, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getDownloadFaviconsEnabled(settings: WebSettings): Boolean
```

Returns whether the WebView will download a Favicon upon navigation.

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

### getEnterpriseAuthenticationAppLinkPolicyEnabled

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

```
@RequiresFeature(name = WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getEnterpriseAuthenticationAppLinkPolicyEnabled(settings: WebSettings): Boolean
```

Gets whether EnterpriseAuthenticationAppLinkPolicy is allowed to have any effect on WebView.

See [this](https://source.chromium.org/chromium/chromium/src/+/main:components/policy/resources/policy_templates.json;l=32321?q=EnterpriseAuthenticationAppLinkPolicy+file:policy_templates.json) for more information on EnterpriseAuthenticationAppLinkPolicy.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if EnterpriseAuthenticationAppLinkPolicy is enabled and `false` otherwise. |

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

### getForceDark

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

```
@RequiresFeature(name = WebViewFeature.FORCE_DARK, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [getForceDark](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDark(android.webkit.WebSettings))(settings: WebSettings): Int
```

> [!CAUTION]
> **This function is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Get the force dark mode for this WebView.

The default force dark mode is `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_AUTO()`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the currently set force dark mode. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` |   |

### getForceDarkStrategy

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

```
@RequiresFeature(name = WebViewFeature.FORCE_DARK_STRATEGY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [getForceDarkStrategy](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDarkStrategy(android.webkit.WebSettings))(settings: WebSettings): Int
```

> [!CAUTION]
> **This function is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Get how content is darkened for this WebView.

The default force dark strategy is `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING()`

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the currently set force dark strategy. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int)` |   |

### getHasEnrolledInstrumentEnabled

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

```
@RequiresFeature(name = WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getHasEnrolledInstrumentEnabled(settings: WebSettings): Boolean
```

Get the current status of `hasEnrolledInstrument()` method in [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether `PaymentRequest.hasEnrolledInstrument()` is enabled for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |

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

### getOffscreenPreRaster

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

```
@RequiresFeature(name = WebViewFeature.OFF_SCREEN_PRERASTER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getOffscreenPreRaster(settings: WebSettings): Boolean
```

Gets whether this WebView should raster tiles when it is offscreen but attached to a window.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this WebView will raster tiles when it is offscreen but attached to a window. |

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

### getPaymentRequestEnabled

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

```
@RequiresFeature(name = WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getPaymentRequestEnabled(settings: WebSettings): Boolean
```

Get the current status of [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether [PaymentRequest](https://w3c.github.io/payment-request/) is enabled. |

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

### getRequestedWithHeaderOriginAllowList

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

```
@RequiresFeature(name = WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [getRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getRequestedWithHeaderOriginAllowList(android.webkit.WebSettings))(settings: WebSettings): (Mutable)Set<String!>
```

> [!CAUTION]
> **This function is deprecated.**   
>
> The origin trial to disable the X-Requested-With feature has ended, so this API now just returns an empty set.

Get the currently configured allow-list of origins, which is guaranteed to receive the `X-Requested-With` HTTP header on requests from the `https://developer.android.com/reference/android/webkit/WebView.html` owning the passed `https://developer.android.com/reference/android/webkit/WebSettings.html`.

Any origin *not* on this allow-list may not receive the header, depending on the current installed WebView provider.

The format of the strings in the allow-list follows the origin rules of `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | The configured set of allow-listed origins. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setRequestedWithHeaderOriginAllowList(android.webkit.WebSettings,java.util.Set<java.lang.String>)` |   |

### getSafeBrowsingEnabled

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

```
@RequiresFeature(name = WebViewFeature.SAFE_BROWSING_ENABLE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getSafeBrowsingEnabled(settings: WebSettings): Boolean
```

Gets whether Safe Browsing is enabled. See `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setSafeBrowsingEnabled(android.webkit.WebSettings,boolean)`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if Safe Browsing is enabled and `false` otherwise. |

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

### getSpeculativeLoadingStatus

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

```
@RequiresFeature(name = WebViewFeature.SPECULATIVE_LOADING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@WebSettingsCompat.ExperimentalSpeculativeLoading
java-static fun getSpeculativeLoadingStatus(settings: WebSettings): Int
```

Gets speculative loading status for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. This API is experimental, it may change in the future without notice. Please use accordingly.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The current status for the speculative loading. It will to be one of `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.SpeculativeLoadingStatus`. |

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

### getUserAgentMetadata

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

```
@RequiresFeature(name = WebViewFeature.USER_AGENT_METADATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getUserAgentMetadata(settings: WebSettings): UserAgentMetadata
```

Get the WebView's user-agent metadata which used to generate user-agent client hints.

See [this](https://wicg.github.io/ua-client-hints/) for more information about User-Agent Client Hints.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

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

### getWebAuthenticationSupport

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

```
@RequiresFeature(name = WebViewFeature.WEB_AUTHENTICATION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun getWebAuthenticationSupport(settings: WebSettings): Int
```

Returns the support level for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the current support level. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setWebAuthenticationSupport(android.webkit.WebSettings,int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_APP()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER()` |   |

### getWebViewMediaIntegrityApiStatus

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

```
@RequiresFeature(name = WebViewFeature.WEBVIEW_MEDIA_INTEGRITY_API_STATUS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getWebViewMediaIntegrityApiStatus(settings: WebSettings): WebViewMediaIntegrityApiStatusConfig
```

Returns the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig` currently in use.

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

### isAlgorithmicDarkeningAllowed

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

```
@RequiresFeature(name = WebViewFeature.ALGORITHMIC_DARKENING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun isAlgorithmicDarkeningAllowed(settings: WebSettings): Boolean
```

Get if algorithmic darkening is allowed or not for this WebView. The default is false.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | if the algorithmic darkening is allowed or not. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean)` |   |

### setAlgorithmicDarkeningAllowed

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

```
@RequiresFeature(name = WebViewFeature.ALGORITHMIC_DARKENING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setAlgorithmicDarkeningAllowed(settings: WebSettings, allow: Boolean): Unit
```

Control whether algorithmic darkening is allowed.

**Note:** This API and the behaviour described only apply to apps with `targetSdkVersion` ≥ `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`.

WebView always sets the media query `prefers-color-scheme` according to the app's theme attribute `android.R.styleable#Theme_isLightTheme isLightTheme`, i.e. `prefers-color-scheme` is `light` if isLightTheme is true or not specified, otherwise it is `dark`. This means that the web content's light or dark style will be applied automatically to match the app's theme if the content supports it.

Algorithmic darkening is disallowed by default.

If the app's theme is dark and it allows algorithmic darkening, WebView will attempt to darken web content using an algorithm, if the content doesn't define its own dark styles and doesn't explicitly disable darkening.

If Android is applying Force Dark to WebView then WebView will ignore the value of this setting and behave as if it were set to true.

The deprecated `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` and related API are no-ops in apps with `targetSdkVersion` ≥ `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`, but they still apply to apps with `targetSdkVersion`\<`https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`.

The below table summarizes how APIs work with different apps.

| App | Web content which uses prefers-color-scheme | Web content which does not use prefers-color-scheme |
|---|---|---|
| App with `isLightTheme` True or not set | Renders with the light theme defined by the content author. | Renders with the default styling defined by the content author. |
| App with Android forceDark in effect | Renders with the dark theme defined by the content author. | Renders with the styling modified to dark colors by an algorithm if allowed by the content author. |
| App with `isLightTheme` False, `targetSdkVersion`\<`https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`, and has `FORCE_DARK_AUTO` | Renders with the dark theme defined by the content author. | Renders with the default styling defined by the content author. |
| App with `isLightTheme` False, `targetSdkVersion` ≥ `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`, and `setAlgorithmicDarkening(false)` | Renders with the dark theme defined by the content author. | Renders with the default styling defined by the content author. |
| App with `isLightTheme` False, `targetSdkVersion` ≥ `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU`, and `setAlgorithmicDarkening(true)` | Renders with the dark theme defined by the content author. | Renders with the styling modified to dark colors by an algorithm if allowed by the content author. |

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The WebSettings object to update. |
| `allow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | allow algorithmic darkening or not. |

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

### setAttributionRegistrationBehavior

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

```
@RequiresFeature(name = WebViewFeature.ATTRIBUTION_REGISTRATION_BEHAVIOR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [setAttributionRegistrationBehavior](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAttributionRegistrationBehavior(android.webkit.WebSettings,int))(settings: WebSettings, behavior: Int): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> In WebView version 152 and later, Attribution Reporting is no longer supported by WebView.

Control how WebView interacts with [Attribution Reporting](https://developer.android.com/design-for-safety/privacy-sandbox/attribution).

WebView supports [Attribution Reporting](https://github.com/WICG/attribution-reporting-api) across [apps and web pages](https://developer.android.com/design-for-safety/privacy-sandbox/attribution-app-to-web) by enabling the web content to register sources and triggers.

By default, attribution sources will be registered as attributed to the app, while triggers are attributed to the loaded web content (`https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER()`). Apps should only need to change this default if they have a specific semantic for how they use WebView. In particular, in-app browsers should follow the steps to apply to the [allowlist for registering web sources](https://developer.android.com/design-for-safety/privacy-sandbox/attribution-app-to-web#register-attribution) and then set the `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` behavior.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `behavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | New behavior to use. |

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

| See also |
|---|---|
| `https://developer.android.com/design-for-safety/privacy-sandbox/attribution-app-to-web#register-attribution` | [How to apply to use web source](https://developer.android.com/design-for-safety/privacy-sandbox/attribution-app-to-web#register-attribution) |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER()` |   |

### setBackForwardCacheEnabled

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

```
@RequiresFeature(name = WebViewFeature.BACK_FORWARD_CACHE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setBackForwardCacheEnabled(
    settings: WebSettings,
    backForwardCacheEnabled: Boolean
): Unit
```

Enables [BackForwardCache](https://developer.chrome.com/blog/back-forward-cache) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `backForwardCacheEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether BackForwardCache should be enabled for this `https://developer.android.com/reference/android/webkit/WebSettings.html` |

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

### setCookiesIncludedInShouldInterceptRequest

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

```
@RequiresFeature(name = WebViewFeature.COOKIE_INTERCEPT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setCookiesIncludedInShouldInterceptRequest(
    settings: WebSettings,
    enabled: Boolean
): Unit
```

This method controls if the relevant `Cookie` header will be added to the `https://developer.android.com/reference/android/webkit/WebResourceRequest.html` object passed to `https://developer.android.com/reference/android/webkit/WebViewClient.html#shouldInterceptRequest(android.webkit.WebView, android.webkit.WebResourceRequest)`. It also enables the use of `https://developer.android.com/reference/kotlin/androidx/webkit/WebResourceResponseCompat#setCookies(java.util.List<java.lang.String>)`, which will otherwise be ignored.

Prefer using this method over calling `https://developer.android.com/reference/android/webkit/CookieManager.html` as part of intercepting requests if it is necessary to access cookies, as this approach will provide the correct set of cookies for the request.

This method should only be called if `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)` returns `true` for `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#COOKIE_INTERCEPT()`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether cookie access during request intercept should be enabled. |

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

### setDisabledActionModeMenuItems

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

```
@RequiresFeature(name = WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setDisabledActionModeMenuItems(settings: WebSettings, menuItems: Int): Unit
```

Disables the action mode menu items according to `menuItems` flag.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The WebSettings object to update. |
| `menuItems: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | an integer field flag for the menu items to be disabled. Value is either `0` or a combination of the following: - `WebSettings.MENU_ITEM_NONE` - `WebSettings.MENU_ITEM_SHARE` - `WebSettings.MENU_ITEM_WEB_SEARCH` - `WebSettings.MENU_ITEM_PROCESS_TEXT` <br /> |

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

### setDownloadFaviconsEnabled

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

```
@RequiresFeature(name = WebViewFeature.DOWNLOAD_FAVICONS_ENABLED, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setDownloadFaviconsEnabled(settings: WebSettings, enabled: Boolean): Unit
```

Sets whether the WebView will download a Favicon upon navigation.

If you are not using Favicons it is recommended to set this to false to save resources like bandwidth and memory.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The WebSettings object to update |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether downloading favicons is enabled |

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

### setEnterpriseAuthenticationAppLinkPolicyEnabled

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

```
@RequiresFeature(name = WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setEnterpriseAuthenticationAppLinkPolicyEnabled(
    settings: WebSettings,
    enabled: Boolean
): Unit
```

Sets whether EnterpriseAuthenticationAppLinkPolicy if set by admin is allowed to have any effect on WebView.

EnterpriseAuthenticationAppLinkPolicy in WebView allows admins to specify authentication urls. When WebView is redirected to authentication url, and an app on the device has registered as the default handler for the url, that app is launched.

EnterpriseAuthenticationAppLinkPolicy is enabled by default.

See [this](https://source.chromium.org/chromium/chromium/src/+/main:components/policy/resources/policy_templates.json;l=32321?q=EnterpriseAuthenticationAppLinkPolicy+file:policy_templates.json) for more information on EnterpriseAuthenticationAppLinkPolicy.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The WebSettings object to update. |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether EnterpriseAuthenticationAppLinkPolicy should be enabled. |

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

### setForceDark

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

```
@RequiresFeature(name = WebViewFeature.FORCE_DARK, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [setForceDark](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int))(settings: WebSettings, forceDarkMode: Int): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> The "force dark" model previously implemented by WebView was complex and didn't interoperate well with current Web standards for `prefers-color-scheme` and `color-scheme`. In apps with `targetSdkVersion` ≥ `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#TIRAMISU` this API is a no-op and WebView will always use the dark style defined by web content authors if the app's theme is dark. To customize the behavior, refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean)`.

Set the force dark mode for this WebView.

If equals to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#FORCE_DARK_ON()` then `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int)` is used to specify darkening strategy.

| Parameters |
|---|---|
| `forceDarkMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the force dark mode to set. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDark(android.webkit.WebSettings)` |   |

### setForceDarkStrategy

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

```
@RequiresFeature(name = WebViewFeature.FORCE_DARK_STRATEGY, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [setForceDarkStrategy](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int))(settings: WebSettings, forceDarkBehavior: Int): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> refer to `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`

Set how WebView content should be darkened.

The specified strategy is only used if force dark mode is on. See `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`.

| Parameters |
|---|---|
| `forceDarkBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the force dark strategy to set. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#getForceDarkStrategy(android.webkit.WebSettings)` |   |

### setHasEnrolledInstrumentEnabled

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

```
@RequiresFeature(name = WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setHasEnrolledInstrumentEnabled(settings: WebSettings, enabled: Boolean): Unit
```

Enables support for `hasEnrolledInstrument()` method in [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`. This only has any effect if `WebSettingsCompat.setPaymentRequestEnabled(settings, true)` has been called.

When this setting is disabled, the `PaymentRequest.hasEnrolledInstrument()` method always returns `false`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether `PaymentRequest.hasEnrolledInstrument()` should be enabled for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |

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

### setHyperlinkContextMenuItems

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

```
@RequiresFeature(name = WebViewFeature.HYPERLINK_CONTEXT_MENU_ITEMS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setHyperlinkContextMenuItems(
    settings: WebSettings,
    hyperlinkMenuItems: Int
): Unit
```

Sets which items appear in the context menu when a user long-presses a hyperlink. The default value is HyperlinkContextMenuItems.DISABLED which means no menu is shown.

The items are specified using bitwise flags. You can combine multiple items using the bitwise OR operator (\`\|\`). For example:

```kotlin
// Show only "Copy link address" and "Open link".
webSettings.setHyperlinkContextMenuItems(
    WebSettingsCompat.HyperlinkContextMenuItems.COPY_LINK_ADDRESS |
        WebSettingsCompat.HyperlinkContextMenuItems.OPEN_LINK);
```

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The `https://developer.android.com/reference/android/webkit/WebSettings.html` instance to apply the items to. |
| `hyperlinkMenuItems: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A bitwise combination of the following flags: - `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_DISABLED()` - `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_ADDRESS()` - `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT()` - `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK()` Note: The `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_DISABLED()` flag should not be used in conjunction with the other flags. If it is, it will be ignored. |

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

### setOffscreenPreRaster

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

```
@RequiresFeature(name = WebViewFeature.OFF_SCREEN_PRERASTER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setOffscreenPreRaster(settings: WebSettings, enabled: Boolean): Unit
```

Sets whether this WebView should raster tiles when it is offscreen but attached to a window. Turning this on can avoid rendering artifacts when animating an offscreen WebView on-screen. Offscreen WebViews in this mode use more memory. The default value is false. Please follow these guidelines to limit memory usage:

- WebView size should be not be larger than the device screen size.
- Limit use of this mode to a small number of WebViews. Use it for visible WebViews and WebViews about to be animated to visible.

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

### setPaymentRequestEnabled

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

```
@RequiresFeature(name = WebViewFeature.PAYMENT_REQUEST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setPaymentRequestEnabled(settings: WebSettings, enabled: Boolean): Unit
```

Enables [PaymentRequest](https://w3c.github.io/payment-request/) for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`.

This feature requires adding the following snippet to the `AndroidManifest.xml`:

```kotlin
  <queries>
      <intent>
          <action android:name="org.chromium.intent.action.PAY"/>
      </intent>
      <intent>
          <action android:name="org.chromium.intent.action.IS_READY_TO_PAY"/>
      </intent>
      <intent>
          <action android:name="org.chromium.intent.action.UPDATE_PAYMENT_DETAILS"/>
      </intent>
  </queries>
```

This is needed to allow WebView to query the device for the user's payment applications that are implemented according to the [Android payment app developers guide](https://web.dev/articles/android-payment-apps-developers-guide).

- The `org.chromium.intent.action.PAY` intent is necessary to let users [make payments](https://web.dev/articles/android-payment-apps-developers-guide
  #step_3_let_a_customer_make_payment).
- The `org.chromium.intent.action.IS_READY_TO_PAY` intent is necessary to let the merchant website know if the user is [ready to pay](https://web.dev/articles/android-payment-apps-developers-guide
  #step_2_let_a_merchant_know_if_a_customer_has_an_enrolled_instrument_that_is_ready_to_pay).
- The `org.chromium.intent.action.UPDATE_PAYMENT_DETAILS` intent is necessary for payment apps to support [updating the price dynamically](https://web.dev/articles/android-payment-apps-delegation
  #optional_support_dynamic_flow) in response to the user selecting a different shipping address or option.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether [PaymentRequest](https://w3c.github.io/payment-request/)should be enabled for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. |

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

### setRequestedWithHeaderOriginAllowList

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

```
@RequiresFeature(name = WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun [setRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#setRequestedWithHeaderOriginAllowList(android.webkit.WebSettings,java.util.Set<java.lang.String>))(
    settings: WebSettings,
    allowList: (Mutable)Set<String!>
): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> The origin trial to disable the X-Requested-With feature has ended, so this API no longer does anything.

Set an allow-list of origins to receive the `X-Requested-With` HTTP header from the WebView owning the passed `https://developer.android.com/reference/android/webkit/WebSettings.html`.

Historically, this header was sent on all requests from WebView, containing the app package name of the embedding app. Depending on the version of installed WebView, this may no longer be the case, as the header was deprecated in late 2022, and its use discontinued.

Apps can use this method to restore the legacy behavior for servers that still rely on the deprecated header, but it should not be used to identify the WebView to first-party servers under the control of the app developer.

The format of the strings in the allow-list follows the origin rules of `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `allowList: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | Set of origins to allow-list. |

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

### setSafeBrowsingEnabled

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

```
@RequiresFeature(name = WebViewFeature.SAFE_BROWSING_ENABLE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setSafeBrowsingEnabled(settings: WebSettings, enabled: Boolean): Unit
```

Sets whether Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links.

Safe Browsing can be disabled for all WebViews using a manifest tag (read [general Safe Browsing info](https://developer.android.com/reference/android/webkit/WebView)). The manifest tag has a lower precedence than this API.

Safe Browsing is enabled by default for devices which support it.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | The WebSettings object to update. |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether Safe Browsing is enabled. |

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

### setSpeculativeLoadingStatus

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

```
@RequiresFeature(name = WebViewFeature.SPECULATIVE_LOADING, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@WebSettingsCompat.ExperimentalSpeculativeLoading
java-static fun setSpeculativeLoadingStatus(
    settings: WebSettings,
    speculativeLoadingStatus: Int
): Unit
```

Sets whether speculative loading status for this `https://developer.android.com/reference/android/webkit/WebSettings.html`. This API is experimental, it may change in the future without notice. Please use accordingly.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `speculativeLoadingStatus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The new status for the speculative loading. It will to be one of `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat.SpeculativeLoadingStatus` |

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

### setUserAgentMetadata

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

```
@RequiresFeature(name = WebViewFeature.USER_AGENT_METADATA, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setUserAgentMetadata(settings: WebSettings, metadata: UserAgentMetadata): Unit
```

Sets the WebView's user-agent metadata to generate user-agent client hints.

UserAgentMetadata in WebView is used to populate user-agent client hints, they can provide the client's branding and version information, the underlying operating system's branding and major version, as well as details about the underlying device.

The user-agent string can be set with `https://developer.android.com/reference/android/webkit/WebSettings.html#setUserAgentString(java.lang.String)`, here are the details on how this API interacts it to generate user-agent client hints.

If the UserAgentMetadata is null and the overridden user-agent contains the system default user-agent, the system default value will be used.

If the UserAgentMetadata is null but the overridden user-agent doesn't contain the system default user-agent, only the [low-entry user-agent client hints](https://wicg.github.io/client-hints-infrastructure/#low-entropy-hint-table) will be generated.

See [this](https://wicg.github.io/ua-client-hints/) for more information about User-Agent Client Hints.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `metadata: https://developer.android.com/reference/kotlin/androidx/webkit/UserAgentMetadata` | the WebView's user-agent metadata. |

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

### setWebAuthenticationSupport

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

```
@RequiresFeature(name = WebViewFeature.WEB_AUTHENTICATION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
java-static fun setWebAuthenticationSupport(settings: WebSettings, support: Int): Unit
```

Sets the support level for the given `https://developer.android.com/reference/android/webkit/WebSettings.html`.

| Parameters |
|---|---|
| `settings: https://developer.android.com/reference/android/webkit/WebSettings.html` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `support: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The new support level which this WebView will use. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_APP()` |   |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER()` |   |

### setWebViewMediaIntegrityApiStatus

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

```
@RequiresFeature(name = WebViewFeature.WEBVIEW_MEDIA_INTEGRITY_API_STATUS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun setWebViewMediaIntegrityApiStatus(
    settings: WebSettings,
    permissionConfig: WebViewMediaIntegrityApiStatusConfig
): Unit
```

Sets permissions provided through `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewMediaIntegrityApiStatusConfig` for using the WebView Integrity API.

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