# Clear App Cache

{% hint style="info" %}
You'll need to import the javascript file in your website before starting from this [link](https://docs.webtonative.com/javascript-apis/getting-started).
{% endhint %}

To clear the cache when app is running.

{% tabs %}
{% tab title="Plain Javascript" %}

```javascript
window.WTN.clearAppCache({ cacheOnly: true, reload: false });
```

Note :- If you want to reload the app after cache is cleared you can call the function as below.

```javascript
window.WTN.clearAppCache({ cacheOnly: true, reload: true });
```

Note :- If you want to clear all stored app data (not just cache) you can call the function as below.

```javascript
window.WTN.clearAppCache({ cacheOnly: false, reload: true });
```

{% endtab %}

{% tab title="ES5+" %}

```javascript
import { clearAppCache } from "webtonative";

clearAppCache({ cacheOnly: true, reload: false });
```

Note :- If you want to reload the app after cache is cleared you can call the function as below.

```javascript
clearAppCache({ cacheOnly: true, reload: true });
```

Note :- If you want to clear all stored app data (not just cache) you can call the function as below.

```javascript
clearAppCache({ cacheOnly: false, reload: true });
```

{% endtab %}
{% endtabs %}

Parameters:

| Key         | Type      | Description                                                                             |
| ----------- | --------- | --------------------------------------------------------------------------------------- |
| `cacheOnly` | `Boolean` | If `true`, clears only the app cache. If `false`, clears all stored app data.           |
| `reload`    | `Boolean` | If `true`, reloads the WebView after clearing. If `false`, the WebView is not reloaded. |

Feature released on Android on 15/08/2023\
Feature released on iOS on 01/03/2026
