Web Engine
JavaScript, DOM storage, cookies, cache, user agent, zoom
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)
Default: true
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)
Default: true
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)
Default: true
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)
Default: false
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
Default: LOAD_DEFAULT
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)
Default: (blank)
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
Default: NORMAL
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)
Default: true
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)
Default: true
10. Zoom
10.1. Support Zoom
Sets whether the WebView should support zooming using its on-screen zoom controls and gestures.
Android API: WebSettings#setSupportZoom(boolean)
Default: true
10.2. 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)
Default: true
10.3. 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)
Default: false
10.4. 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)
Default: 0
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)
accordingly.
11.1. 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)
Default: false
11.2. 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)
Default: false
12. Media Playback Requires User Gesture
Sets whether the WebView requires a user gesture (e.g. tap) to play media.
Android API: WebSettings#setUseWideViewPort(boolean)
Default: true
13. 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
14. 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)
Default: Never Allow
15. 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)
Default: If Content Scrolls
16. 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)
Default: true