Safari Web Extension - storage.session not available on iPad v16.3

I'm creating a Safari Web Extension, which successfully uses storage.local and storage.session on MacOS (14.x/15.x) and iOS (15.x,18.x). However, when testing on an iPad running iPadOS 16.3, it fails with an undefined error:

TypeError: undefined is not an object (evaluating 'api.storage.session.get')

Dropping to the console, I can access 'api.storage.local', but no luck for 'api.storage.session'.

First question, why would storage.session not be available? Is there something different on this iPadOS version to enable it? I could just use local storage, but don't need the data to persist. I'll probably just fall back to this solution.

Second question, should I instead be using localStorage and sessionStorage? I can't find any helpful direction on if using localStorage vs storage.local is best practice?

Answered by Frameworks Engineer in 828710022

Support for storage.session was added in iOS / iPadOS 16.4. It will be unavailable in 16.3. You should feature detect by checking if storage.session is defined before trying to use it, and maybe fallback to storage.local.

Accepted Answer

Support for storage.session was added in iOS / iPadOS 16.4. It will be unavailable in 16.3. You should feature detect by checking if storage.session is defined before trying to use it, and maybe fallback to storage.local.

Safari Web Extension - storage.session not available on iPad v16.3
 
 
Q