# 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)

*** ** * ** ***


```
public 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/androidx/annotation/RequiresOptIn(level = https://developer.android.com/reference/androidx/annotation/RequiresOptIn.Level#ERROR) public annotation https://developer.android.com/reference/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/androidx/annotation/RequiresOptIn(level = https://developer.android.com/reference/androidx/annotation/RequiresOptIn.Level#ERROR) public annotation https://developer.android.com/reference/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading` Denotes that the SpeculativeLoading API surface is experimental. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER() = 3` **This field is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER() = 1` **This field is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED() = 0` **This field is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER() = 2` **This field is deprecated.** In WebView version 152 and later, Attribution Reporting is no longer supported by WebView. <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING() = 2` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_USER_AGENT_DARKENING_ONLY() = 0` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_WEB_THEME_DARKENING_ONLY() = 1` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#FORCE_DARK_AUTO() = 1` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#FORCE_DARK_OFF() = 0` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#FORCE_DARK_ON() = 2` **This field is deprecated.** refer to `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)` <br /> |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `@https://developer.android.com/reference/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#SPECULATIVE_LOADING_DISABLED() = 0` Disables all speculative loading tech. |
| `static final int` | `@https://developer.android.com/reference/androidx/webkit/WebSettingsCompat.ExperimentalSpeculativeLoading https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER() = 2` The support level that allows apps to make WebAuthn calls for any website. |
| `static final int` | `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE() = 0` The support level that disables WebAuthn requests from WebView. |

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

```
public static final int ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER = 3
```

> [!CAUTION]
> **This field 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)

```
public static final int ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER = 1
```

> [!CAUTION]
> **This field 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)

```
public static final int ATTRIBUTION_BEHAVIOR_DISABLED = 0
```

> [!CAUTION]
> **This field 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)

```
public static final int ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER = 2
```

> [!CAUTION]
> **This field 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)

```
public static final int DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING = 2
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/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)

```
public static final int DARK_STRATEGY_USER_AGENT_DARKENING_ONLY = 0
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/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)

```
public static final int DARK_STRATEGY_WEB_THEME_DARKENING_ONLY = 1
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/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)

```
public static final int FORCE_DARK_AUTO = 1
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/androidx/webkit/WebSettingsCompat#FORCE_DARK_ON()` or `https://developer.android.com/reference/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/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)

```
public static final int FORCE_DARK_OFF = 0
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/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)

```
public static final int FORCE_DARK_ON = 2
```

> [!CAUTION]
> **This field is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/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)

```
public static final int HYPERLINK_CONTEXT_MENU_DISABLED = 0
```

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)

```
public static final int 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.

### HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT

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

```
public static final int 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.

### HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK

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

```
public static final int HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK = 4
```

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
public static final int SPECULATIVE_LOADING_DISABLED = 0
```

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
public static final int SPECULATIVE_LOADING_PRERENDER_ENABLED = 1
```

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)

```
public static final int WEB_AUTHENTICATION_SUPPORT_FOR_APP = 1
```

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)

```
public static final int WEB_AUTHENTICATION_SUPPORT_FOR_BROWSER = 2
```

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)

```
public static final int WEB_AUTHENTICATION_SUPPORT_NONE = 0
```

The support level that disables WebAuthn requests from WebView.

This is the default behavior.

## Public methods

### 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")
public static boolean areCookiesIncludedInShouldInterceptRequest(
    @NonNull WebSettings settings
)
```

Returns whether cookie access during request intercept is enabled.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | 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/androidx/webkit/WebViewFeature#COOKIE_INTERCEPT()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static int [getAttributionRegistrationBehavior](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#getAttributionRegistrationBehavior(android.webkit.WebSettings))(@NonNull WebSettings settings)
```

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

Read the current behavior for attribution registration.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | 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/androidx/webkit/WebViewFeature#ATTRIBUTION_REGISTRATION_BEHAVIOR()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setAttributionRegistrationBehavior(android.webkit.WebSettings,int)` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/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")
public static boolean getBackForwardCacheEnabled(@NonNull WebSettings settings)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `boolean` | Whether BackForwardCache is enabled or not. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#BACK_FORWARD_CACHE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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
public static @NonNull BackForwardCacheSettings getBackForwardCacheSettings(@NonNull WebSettings settings)
```

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

The returned `https://developer.android.com/reference/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/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/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/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")
public static int getDisabledActionModeMenuItems(@NonNull WebSettings settings)
```

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 |
|---|---|
| `int` | 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/androidx/webkit/WebViewFeature#DISABLED_ACTION_MODE_MENU_ITEMS()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static boolean getDownloadFaviconsEnabled(@NonNull WebSettings settings)
```

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/androidx/webkit/WebViewFeature#DOWNLOAD_FAVICONS_ENABLED()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static boolean getEnterpriseAuthenticationAppLinkPolicyEnabled(
    @NonNull WebSettings settings
)
```

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 |
|---|---|
| `boolean` | `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/androidx/webkit/WebViewFeature#ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static int [getForceDark](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#getForceDark(android.webkit.WebSettings))(@NonNull WebSettings settings)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/androidx/webkit/WebSettingsCompat#FORCE_DARK_AUTO()`.

| Returns |
|---|---|
| `int` | the currently set force dark mode. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static int [getForceDarkStrategy](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#getForceDarkStrategy(android.webkit.WebSettings))(@NonNull WebSettings settings)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/androidx/webkit/WebSettingsCompat#DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING()`

| Returns |
|---|---|
| `int` | the currently set force dark strategy. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static boolean getHasEnrolledInstrumentEnabled(@NonNull WebSettings settings)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `boolean` | 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/androidx/webkit/WebViewFeature#PAYMENT_REQUEST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static boolean getOffscreenPreRaster(@NonNull WebSettings settings)
```

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

| Returns |
|---|---|
| `boolean` | `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/androidx/webkit/WebViewFeature#OFF_SCREEN_PRERASTER()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static boolean getPaymentRequestEnabled(@NonNull WebSettings settings)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `boolean` | 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/androidx/webkit/WebViewFeature#PAYMENT_REQUEST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static @NonNull Set<String> [getRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#getRequestedWithHeaderOriginAllowList(android.webkit.WebSettings))(@NonNull WebSettings settings)
```

> [!CAUTION]
> **This method 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/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.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/androidx/webkit/WebViewFeature#REQUESTED_WITH_HEADER_ALLOW_LIST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static boolean getSafeBrowsingEnabled(@NonNull WebSettings settings)
```

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

| Returns |
|---|---|
| `boolean` | `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/androidx/webkit/WebViewFeature#SAFE_BROWSING_ENABLE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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
public static int getSpeculativeLoadingStatus(@NonNull WebSettings settings)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `int` | The current status for the speculative loading. It will to be one of `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat.SpeculativeLoadingStatus`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#SPECULATIVE_LOADING()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static @NonNull UserAgentMetadata getUserAgentMetadata(@NonNull WebSettings settings)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | 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/androidx/webkit/WebViewFeature#USER_AGENT_METADATA()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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
public static int getWebAuthenticationSupport(@NonNull WebSettings settings)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |

| Returns |
|---|---|
| `int` | the current support level. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setWebAuthenticationSupport(android.webkit.WebSettings,int)` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_APP()` |   |
| `https://developer.android.com/reference/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")
public static @NonNull WebViewMediaIntegrityApiStatusConfig getWebViewMediaIntegrityApiStatus(@NonNull WebSettings settings)
```

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#WEBVIEW_MEDIA_INTEGRITY_API_STATUS()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static boolean isAlgorithmicDarkeningAllowed(@NonNull WebSettings settings)
```

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

| Returns |
|---|---|
| `boolean` | 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/androidx/webkit/WebViewFeature#ALGORITHMIC_DARKENING()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static void setAlgorithmicDarkeningAllowed(
    @NonNull WebSettings settings,
    boolean allow
)
```

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/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The WebSettings object to update. |
| `boolean allow` | allow algorithmic darkening or not. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#ALGORITHMIC_DARKENING()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void [setAttributionRegistrationBehavior](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setAttributionRegistrationBehavior(android.webkit.WebSettings,int))(
    @NonNull WebSettings settings,
    int behavior
)
```

> [!CAUTION]
> **This method 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/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/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` behavior.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `int behavior` | New behavior to use. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#ATTRIBUTION_REGISTRATION_BEHAVIOR()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_DISABLED()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER()` |   |
| `https://developer.android.com/reference/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")
public static void setBackForwardCacheEnabled(
    @NonNull WebSettings settings,
    boolean backForwardCacheEnabled
)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `boolean backForwardCacheEnabled` | 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/androidx/webkit/WebViewFeature#BACK_FORWARD_CACHE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setCookiesIncludedInShouldInterceptRequest(
    @NonNull WebSettings settings,
    boolean enabled
)
```

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/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/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)` returns `true` for `https://developer.android.com/reference/androidx/webkit/WebViewFeature#COOKIE_INTERCEPT()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `boolean enabled` | 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/androidx/webkit/WebViewFeature#COOKIE_INTERCEPT()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setDisabledActionModeMenuItems(
    @NonNull WebSettings settings,
    int menuItems
)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The WebSettings object to update. |
| `int menuItems` | 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/androidx/webkit/WebViewFeature#DISABLED_ACTION_MODE_MENU_ITEMS()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setDownloadFaviconsEnabled(
    @NonNull WebSettings settings,
    boolean enabled
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The WebSettings object to update |
| `boolean enabled` | Whether downloading favicons is enabled |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#DOWNLOAD_FAVICONS_ENABLED()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setEnterpriseAuthenticationAppLinkPolicyEnabled(
    @NonNull WebSettings settings,
    boolean enabled
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The WebSettings object to update. |
| `boolean enabled` | Whether EnterpriseAuthenticationAppLinkPolicy should be enabled. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void [setForceDark](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int))(@NonNull WebSettings settings, int forceDarkMode)
```

> [!CAUTION]
> **This method 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/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean)`.

Set the force dark mode for this WebView.

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

| Parameters |
|---|---|
| `int forceDarkMode` | the force dark mode to set. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static void [setForceDarkStrategy](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setForceDarkStrategy(android.webkit.WebSettings,int))(
    @NonNull WebSettings settings,
    int forceDarkBehavior
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> refer to `https://developer.android.com/reference/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/androidx/webkit/WebSettingsCompat#setForceDark(android.webkit.WebSettings,int)`.

| Parameters |
|---|---|
| `int forceDarkBehavior` | the force dark strategy to set. |

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

| See also |
|---|---|
| `https://developer.android.com/reference/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")
public static void setHasEnrolledInstrumentEnabled(
    @NonNull WebSettings settings,
    boolean enabled
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `boolean enabled` | 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/androidx/webkit/WebViewFeature#PAYMENT_REQUEST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setHyperlinkContextMenuItems(
    @NonNull WebSettings settings,
    int hyperlinkMenuItems
)
```

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:

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The `https://developer.android.com/reference/android/webkit/WebSettings.html` instance to apply the items to. |
| `int hyperlinkMenuItems` | A bitwise combination of the following flags: - `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_DISABLED()` - `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_ADDRESS()` - `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_COPY_LINK_TEXT()` - `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#HYPERLINK_CONTEXT_MENU_ITEM_OPEN_LINK()` Note: The `https://developer.android.com/reference/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/androidx/webkit/WebViewFeature#HYPERLINK_CONTEXT_MENU_ITEMS()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setOffscreenPreRaster(@NonNull WebSettings settings, boolean enabled)
```

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/androidx/webkit/WebViewFeature#OFF_SCREEN_PRERASTER()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setPaymentRequestEnabled(@NonNull WebSettings settings, boolean enabled)
```

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`:

```
  <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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `boolean enabled` | 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/androidx/webkit/WebViewFeature#PAYMENT_REQUEST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void [setRequestedWithHeaderOriginAllowList](https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setRequestedWithHeaderOriginAllowList(android.webkit.WebSettings,java.util.Set<java.lang.String>))(
    @NonNull WebSettings settings,
    @NonNull Set<String> allowList
)
```

> [!CAUTION]
> **This method 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/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html> allowList` | 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/androidx/webkit/WebViewFeature#REQUESTED_WITH_HEADER_ALLOW_LIST()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setSafeBrowsingEnabled(@NonNull WebSettings settings, boolean enabled)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | The WebSettings object to update. |
| `boolean enabled` | Whether Safe Browsing is enabled. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#SAFE_BROWSING_ENABLE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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
public static void setSpeculativeLoadingStatus(
    @NonNull WebSettings settings,
    int speculativeLoadingStatus
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `int speculativeLoadingStatus` | The new status for the speculative loading. It will to be one of `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat.SpeculativeLoadingStatus` |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#SPECULATIVE_LOADING()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
public static void setUserAgentMetadata(
    @NonNull WebSettings settings,
    @NonNull UserAgentMetadata metadata
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/UserAgentMetadata metadata` | the WebView's user-agent metadata. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#USER_AGENT_METADATA()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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
public static void setWebAuthenticationSupport(@NonNull WebSettings settings, int support)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/webkit/WebSettings.html settings` | Settings retrieved from `https://developer.android.com/reference/android/webkit/WebView.html#getSettings()`. |
| `int support` | 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/androidx/webkit/WebViewFeature#WEB_AUTHENTICATION()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_NONE()` |   |
| `https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#WEB_AUTHENTICATION_SUPPORT_FOR_APP()` |   |
| `https://developer.android.com/reference/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")
public static void setWebViewMediaIntegrityApiStatus(
    @NonNull WebSettings settings,
    @NonNull WebViewMediaIntegrityApiStatusConfig permissionConfig
)
```

Sets permissions provided through `https://developer.android.com/reference/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/androidx/webkit/WebViewFeature#WEBVIEW_MEDIA_INTEGRITY_API_STATUS()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |