IndexedDB access gets completely blocked on iOS

I’ve stumbled upon a peculiar issue while implementing LocalForage in my web app, and I’m wondering if anyone else has encountered this or if I’m doing something wrong here.

I’m using LocalForage to handle data persistence with IndexedDB as the storage engine. The architecture is pretty straightforward:

  • Main thread handles data saving via LocalForage
  • WebWorker reads the stored data and sends it to the server
  • Everything runs smoothly on Android, but not on iOS.

On iOS, if you navigate away from the page while either reading or writing data, the IndexedDB access gets completely blocked – you can’t read or write anything until you reset the browser.

Here’s a simplified version of what I’m doing:

// Main thread
localforage.setItem('key', value).then(() => {
  // This works fine... until it doesn't
});

// Web Worker
localforage.getItem('key').then(value => {
  // This is where iOS decides to throw a tantrum
});

Steps to reproduce:

  1. Open this demo on iOS
  2. Start a save/read operation
  3. Navigate to a different page during the operation
  4. IndexedDB is now blocked

The only way to fix this is a full browser reset.

My questions are:

  1. Has anyone else run into this iOS-specific behavior?
  2. Is this a known limitation of IndexedDB/LocalForage on iOS?
  3. Are there any workarounds?

Environment details:

  • iOS: Tested on 16.7.10, also reproduced on lower and higher versions
  • Browser: Safari and other iOS browsers (they all use WebKit anyway)
  • LocalForage: Latest version
  • IndexedDB: Used as storage driver