> For the complete documentation index, see [llms.txt](https://docs.hello-lisa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hello-lisa.com/developers/guides/integration-guide/app-integration/ios/storage.md).

# Storage

{% hint style="info" %}
Older implementations of `UIWebView` allowed `localStorage` by default, but it has been **deprecated**. If any of your customers are using it, they should **switch to `WKWebView`**.
{% endhint %}

### **Enable localStorage & sessionStorage**

```swift
let webView = WKWebView(frame: .zero, configuration: WKWebViewConfiguration())
webView.configuration.websiteDataStore = WKWebsiteDataStore.default()
```

#### **Enable JavaScript**

Ensure JavaScript is enabled because `localStorage` requires it:

```swift
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
```

### **Prevent WebView Data Loss (iOS 11+)**

By default, `WKWebView` might clear storage (including `localStorage`) when the app is backgrounded. To avoid this, set `default()` storage:

```swift
webView.configuration.websiteDataStore = WKWebsiteDataStore.default()
```
