> ## 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.

# Service workers

> Use service workers for offline access in your Median app. They work out of the box on Android and need App-Bound Domains on iOS 14 and later.

## Service worker overview

Service workers are the web standard for enabling offline functionality, background sync, and push-style caching. If your website already uses a service worker for offline access, that same code can work inside your Median app, but support differs meaningfully between Android and iOS, and iOS requires extra configuration.

> [!WARNING]
>
> **Legacy note**
>
> Both platforms used to support the older HTML5 Application Cache Manifest for offline caching. That API is deprecated and no longer functions on iOS, so if you're migrating an older app, service workers are the only supported path forward on iOS.

## Platform support

| Platform | Support | Setup required |
| - | - | - |
| **Android** | Full support | None, works out of the box |
| **iOS 14+** | Supported with limitations | Requires App-Bound Domains configuration |
| **iOS 13 and earlier** | Not supported | Not available |

## Android

On Android, Median apps render your site inside a standard WebView that supports the Service Worker API the same way Chrome does. If your service worker already works in a mobile browser, it will work in your Median Android app with no additional configuration.

Registration, caching, and the fetch lifecycle all behave as they would on the open web.

## iOS

On iOS, service worker support is available only on **iOS 14 or later** and requires using **App-Bound Domains**. This feature is not supported out of the box in Median apps but can be enabled with custom implementation. Please note that the app will only communicate with the domains added in the configuration.

> [!WARNING]
>
> **Important**
>
> Apple allows a maximum of 10 App-Bound Domains, and wildcards are not permitted. Each subdomain must be listed explicitly.

### Enabling service workers on iOS with Median

1. Download and [build the iOS source code locally](https://docs.median.co/docs/build-ios-from-source.md).
2. Enable App-Bound Domains:
   1. In `LeanIOS > LEANWebViewController.m,` set the following flag on line 320:
      ```objectivec Objective-C theme={null}
      config.limitsNavigationsToAppBoundDomains = YES;
      ```
3. Add the `WKAppBoundDomains` key to your `MedianIOS-Info.plist` file under `LeanIOS > Supporting Files`:
   ```xml XML theme={null}
   <key>WKAppBoundDomains</key>
   <array>
     <string>median.co</string>
     <string>cdn.onesignal.com</string>
     <string>cdnjs.cloudflare.com</string>
     <string>fonts.googleapis.com</string>
     <string>maps.googleapis.com</string>
     <string>onesignal.com</string>
     <string>www.gstatic.com</string>
   </array>
   ```

For more details, refer to:

[Will iOS 14 support Service Workers in WKWebView? (dev.to) ](https://dev.to/ben/will-ios-14-support-service-workers-in-wkwebview-5gn)

[App-Bound Domains overview (webkit.org) ](https://webkit.org/blog/10882/app-bound-domains/)

If you don't have access to a macOS system to build the app, Median can handle the setup for you as part of a small custom development service. [Contact us ](https://median.co/contact?topic=sales-inquiry) to learn more.


## Related topics

- [Offline page](https://docs.median.co/docs/offline-page.md)
- [App interface overview](https://docs.median.co/docs/app-interface-overview.md)
- [Google Services](https://docs.median.co/docs/google-services.md)


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