> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear WebView cache

> Clear the webview cache to show updated content.

If updates to your website aren't appearing in your native app built with Median, the issue is typically related to webview caching.

Median apps respect the same cache headers as modern browsers. This means your web server controls how long content is cached within the app. In most cases, updates will reflect after a few minutes or a page refresh. However, if you're still not seeing the latest changes, it’s likely due to aggressive cache headers or stale cached assets.

## Implementation guide

### Website configuration

To force the app to load the latest version of your assets (for example, JavaScript or CSS files), you can use file versioning like:

```text Text theme={null}
application_782374982.js
styles_782374982.css
```

Updating the filename ensures the browser and app will request a fresh version from the server.

### JavaScript Bridge method

Median provides a JavaScript command to programmatically clear the webview cache. This is especially useful during development or when troubleshooting cache-related display issues.

To clear the cache, call:

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.webview.clearCache();
```

### Android-only

Some configuration options in `appConfig.json` apply specifically to Android apps. These settings allow you to control WebView behavior, including caching.

#### Automatically clear cache on exit

Median includes a configuration option for Android apps to clear the WebView cache every time the app exits. To enable this, add the following in the [appConfig.json](https://docs.median.co/docs/app-configuration-appconfigjson.md):

```json JSON theme={null}
"general": {
  "androidClearCache": true
}
```

#### Configure WebView cache mode

You can also control how the Android WebView handles caching by setting the cacheMode option. Add the following under the general section in your [appConfig.json](https://docs.median.co/docs/app-configuration-appconfigjson.md):

```json JSON theme={null}
"general": {
  "androidCacheMode": "no_cache" // options: no_cache | cache_only | cache_else_network | default
}
```

Available configuration options:

| Configuration | Description |
| - | - |
| `no_cache` | Always load from the network, never use the cache. |
| `cache_only` | Only use cached content, never hit the network. |
| `cache_else_network` | Use cache if available, otherwise fetch from the network. |
| `default` | Use the system’s default caching behavior. |

## Frequently asked questions

> [accordion] Why are my website updates not appearing in my Median app?
>
> Your app may still be loading cached website assets, such as older JavaScript, CSS, image, or HTML files. Median apps respect your website’s cache headers, so your server configuration controls how long those assets remain cached in the app.

> [accordion] Should I call median.webview\.clearCache() every time the app starts?
>
> Usually, no. Clearing the cache too often can reduce performance because the app may need to re-download assets that would otherwise load quickly from cache. For production apps, asset versioning and correct cache headers are usually better long-term solutions.

> [accordion] Does clearing the WebView cache sign users out?
>
> Don't assume either way. This page doesn't confirm whether cookies, local storage, or authentication sessions are affected, so test sign-in behavior in your app before using this in production.

> [accordion] Which Android cache mode should I choose?
>
> Use `default` for normal production behavior. Use `no_cache` when you need Android to always load from the network during testing or troubleshooting. Use `cache_only` only for specialized offline scenarios, and use `cache_else_network` when cached content should be preferred if available.


## Related topics

- [Cookie persistence](https://docs.median.co/docs/cookie-persistence.md)
- [App updates and migration guide](https://docs.median.co/docs/app-updates.md)
- [JavaScript Bridge overview](https://docs.median.co/docs/javascript-bridge.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.