# Web Engine (/docs/settings/web-engine)





## 1. Enable JavaScript [#1-enable-javascript]

When enabled, the WebView can execute JavaScript code on web pages.
This is required for most modern websites to function properly.

**Android API:** [WebSettings#setJavaScriptEnabled(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setJavaScriptEnabled\(boolean\))

**Default:** true

## 2. Enable DOM Storage [#2-enable-dom-storage]

When enabled, websites can use DOM storage APIs such as `localStorage` and `sessionStorage`.
Useful for saving data client-side in the browser context.

**Android API:** [WebSettings#setDomStorageEnabled(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setDomStorageEnabled\(boolean\))

**Default:** true

## 3. Accept Cookies [#3-accept-cookies]

When enabled, the WebView allows websites to store and read cookies.
This includes first-party cookies that persist session or preference data.

**Android API:** [CookieManager#setAcceptCookie(boolean)](https://developer.android.com/reference/android/webkit/CookieManager#setAcceptCookie\(boolean\))

**Default:** true

## 4. Accept Third-party Cookies [#4-accept-third-party-cookies]

When enabled, third-party websites (embedded in iframes or resources) are allowed to set cookies.
This is important for services like embedded analytics or login widgets.

**Android API:** [CookieManager#setAcceptThirdPartyCookies(android.webkit.WebView, boolean)](https://developer.android.com/reference/android/webkit/CookieManager#setAcceptThirdPartyCookies\(android.webkit.WebView,%20boolean\))

**Default:** false

## 5. Cache Mode [#5-cache-mode]

Controls how the WebView uses its cache when loading pages. Options:

* **Default (`LOAD_DEFAULT`)** - Normal caching behavior; the WebView decides when to use cached content.
* **Cache else network (`LOAD_CACHE_ELSE_NETWORK`)** - Uses cached content if available; otherwise fetches from network.
* **No cache (`LOAD_NO_CACHE`)** - Always fetches from the network; ignores cached content.
* **Cache only (`LOAD_CACHE_ONLY`)** - Only loads content from cache; network requests are skipped.

**Android API:** [WebSettings#LOAD\_CACHE\_ELSE\_NETWORK](https://developer.android.com/reference/android/webkit/WebSettings#LOAD_CACHE_ELSE_NETWORK)

**Default:** `LOAD_DEFAULT`

## 6. User Agent [#6-user-agent]

The User Agent string controls how the web engine identifies itself
to websites. Some sites may behave differently depending on this value.

Leave blank to use the system default User Agent.

**Android API:** [WebSettings#setUserAgentString(java.lang.String)](https://developer.android.com/reference/android/webkit/WebSettings#setUserAgentString\(java.lang.String\))

**Default:** (blank)

## 7. Layout Algorithm [#7-layout-algorithm]

Controls how the WebView arranges and scales content. Options:

* **Normal** - No rendering changes. Recommended for maximum compatibility
  across different platforms and Android versions.
* **Single Column** - Moves all content into one column that is the width of
  the view. **Deprecated in API 29**
* **Narrow Columns** - Makes all columns no wider than the screen if possible.
  Only use for API levels prior to KitKat. **Deprecated in API 29**
* **Text Autosizing** - Boosts font size of paragraphs based on heuristics to
  make text readable in wide-viewport layouts. Recommended to enable zoom
  support. Supported from API level KitKat.

**Android API:** [WebSettings.LayoutAlgorithm](https://developer.android.com/reference/android/webkit/WebSettings.LayoutAlgorithm)

**Default:** `NORMAL`

## 8. Use Wide ViewPort [#8-use-wide-viewport]

When enabled, the WebView will use a viewport wide enough to fit the content as if viewed on a desktop browser.

**Android API:** [WebSettings#setUseWideViewPort(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setUseWideViewPort\(boolean\))

**Default:** true

## 9. Load With Overview Mode [#9-load-with-overview-mode]

When enabled, the WebView scales the page so that the content fits on screen
initially.

**Android API:** [WebSettings#setLoadWithOverviewMode(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setLoadWithOverviewMode\(boolean\))

**Default:** true

## 10. Zoom [#10-zoom]

### 10.1. Support Zoom [#101-support-zoom]

Sets whether the WebView should support zooming using its on-screen zoom
controls and gestures.

**Android API:** [WebSettings#setSupportZoom(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setSupportZoom\(boolean\))

**Default:** true

### 10.2. Built In Zoom Controls [#102-built-in-zoom-controls]

Sets whether the WebView should use its built-in zoom mechanisms.

The built-in zoom mechanisms comprise on-screen zoom controls, which are
displayed over the WebView's content, and the use of a pinch gesture to
control zooming.

**Android API:** [WebSettings#setBuiltInZoomControls(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setBuiltInZoomControls\(boolean\))

**Default:** true

### 10.3. Display Zoom Controls [#103-display-zoom-controls]

Sets whether the WebView should display on-screen zoom controls when using the
built-in zoom mechanisms.

**Android API:** [WebSettings#setDisplayZoomControls(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setDisplayZoomControls\(boolean\))

**Default:** false

### 10.4. Initial Scale [#104-initial-scale]

Sets the initial scale for this WebView as a percentage. 0 means default.

The behavior for the default scale depends on the state of

* useWideViewPort
* loadWithOverviewMode

If the content fits into the WebView control by width, the zoom is set to 100%.

For wide content, the behaviour depends on the state of loadWithOverviewMode.
If its value is true, the content will be zoomed out to be fit by width into
the WebView control, otherwise not.

If initial scale is greater than 0, WebView starts with this value as initial
scale. Please note that unlike the scale properties in the viewport meta tag,
this method doesn't take the screen density into account.

**Android API:** [WebView#setInitialScale(int)](https://developer.android.com/reference/android/webkit/WebView#setInitialScale\(int\))

**Default:** 0

## 11. File Access [#11-file-access]

These settings are insecure and deprecated.

To access `file://` URLs, you will also need to enable `Web Content -> Allow Local Files`, which will set
[WebSettings#setAllowFileAccess(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess\(boolean\))
accordingly.

### 11.1. Allow File Access from File URLs [#111-allow-file-access-from-file-urls]

This method was deprecated in API level 30.

Sets whether cross-origin requests in the context of a file scheme URL should
be allowed to access content from other file scheme URLs. Note that some
accesses such as image HTML elements don't follow same-origin rules and aren't
affected by this setting.

Don't enable this setting if you open files that may be created or altered by
external sources. Enabling this setting allows malicious scripts loaded in a
`file://` context to access arbitrary local files including WebView cookies and
app private data.

**Android API:** [WebSettings#setAllowFileAccessFromFileURLs(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccessFromFileURLs\(boolean\))

**Default:** false

### 11.2. Allow Universal Access from File URLs [#112-allow-universal-access-from-file-urls]

This method was deprecated in API level 30.

Sets whether cross-origin requests in the context of a file scheme URL should
be allowed to access content from any origin. This includes access to content
from other file scheme URLs or web contexts. Note that some access such as
image HTML elements doesn't follow same-origin rules and isn't affected by this
setting.

Don't enable this setting if you open files that may be created or altered by
external sources. Enabling this setting allows malicious scripts loaded in a
`file://` context to launch cross-site scripting attacks, either accessing
arbitrary local files including WebView cookies, app private data or even
credentials used on arbitrary web sites.

**Android API:** [WebSettings#setAllowUniversalAccessFromFileURLs(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setAllowUniversalAccessFromFileURLs\(boolean\))

**Default:** false

## 12. Allow File Picker [#12-allow-file-picker]

Allow websites to open the system file picker, e.g. for uploading files.

**Android API:** <a href="https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback%3Candroid.net.Uri[]%3E,%20android.webkit.WebChromeClient.FileChooserParams)" target="_blank" rel="noopener noreferrer">WebChromeClient#onShowFileChooser</a>

**Default:** false

## 13. Allow File Download [#13-allow-file-download]

Allow files to be downloaded from websites to the device's default
download directory, e.g. `/storage/emulated/0/Download/`

For Android 9.0 (SDK 28) and below, the `WRITE_EXTERNAL_STORAGE`
permission is required.

**Android API:** [WebView#setDownloadListener(android.webkit.DownloadListener)](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener\(android.webkit.DownloadListener\))

**Default:** false

## 14. Media Playback Requires User Gesture [#14-media-playback-requires-user-gesture]

Sets whether the WebView requires a user gesture (e.g. tap) to play media.

**Android API:** [WebSettings#setUseWideViewPort(boolean)](https://developer.android.com/reference/android/webkit/WebSettings#setMediaPlaybackRequiresUserGesture\(boolean\))

**Default:** true

## 15. SSL Error Mode [#15-ssl-error-mode]

Configure the action to take when an SSL Error is received.

| Mode    | Description                                                      |
| ------- | ---------------------------------------------------------------- |
| Block   | Cancels all failed SSL requests.                                 |
| Prompt  | Opens a dialog for the user to decide.                           |
| Proceed | Always proceeds despite SSL errors (dangerous, NOT RECOMMENDED). |

**Default:** Block

## 16. Mixed Content Mode [#16-mixed-content-mode]

Configures the WebView's behavior when a secure origin attempts to load
a resource from an insecure origin.

| Mode               | Description                                                                                               |
| ------------------ | --------------------------------------------------------------------------------------------------------- |
| Never Allow        | Blocks any mixed content from insecure origins. This is the safest and recommended mode.                  |
| Compatibility Mode | Allows mixed content in a backward-compatible way, depending on Android version. Use with caution.        |
| Always Allow       | Loads mixed content from insecure origins without restriction. Strongly discouraged for security reasons. |

**Android API:** [WebSettings#setMixedContentMode(int)](https://developer.android.com/reference/android/webkit/WebSettings#setMixedContentMode\(int\))

**Default:** Never Allow

## 17. Over Scroll Mode [#17-over-scroll-mode]

Configures the WebView's behavior when the user scrolls beyond the content boundaries.

| Mode               | Description                                                                 |
| ------------------ | --------------------------------------------------------------------------- |
| Always             | Allows over-scroll effect regardless of content size.                       |
| If Content Scrolls | Allow over-scrolling only if the view content is larger than the container. |
| Never              | Prevents any over-scroll effect.                                            |

**Android API:** [WebView#setOverScrollMode(int)](https://developer.android.com/reference/android/webkit/WebView#setOverScrollMode\(int\))

**Default:** If Content Scrolls

## 18. Request Focus On Page Start [#18-request-focus-on-page-start]

Sets whether the WebView should request focus when a page starts loading.

**Android API:** [WebView#requestFocus(int, android.graphics.Rect)](https://developer.android.com/reference/android/webkit/WebView#requestFocus\(int,%20android.graphics.Rect\))

**Default:** true
