jakearchibald / idb-keyval

A super-simple-small promise-based keyval store implemented with IndexedDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SecurityError: IDBFactory.open() called in an invalid security context -- safari

kli123456 opened this issue · comments

This error is reported in Safari browser. The code is as `follows:

import "es6-promise/auto";
import { get, set } from "idb-keyval/dist/esm-compat";

// function
getSession = async() => {
const requestVal = await get(userListCacheName).then(val => val);
return requestVal;
};

Error thrown by Safari:
SecurityError: IDBFactory.open() called in an invalid security context

version: 5.0.5
Safari: 12.0 (14606.1.36.1.9)

Please help to see how to solve it

https://static-misc-3.glitch.me/idb-keyval-test/ this works fine in Safari 12.

I'm happy to provide support, but you need to provide an example of the problem – one that actually reproduces the problem you're seeing. https://stackoverflow.com/help/minimal-reproducible-example

If you do that, I'll reopen the bug.

I also checked the reason yesterday. It seems that it only happens in a cross-domain-loaded iframe apparently.

Can you help me to see the solution?

Please create a minimal reproducible example and I'll help as much as I can https://stackoverflow.com/help/minimal-reproducible-example.

There are many static hosts that make this easy, such as GitHub pages, glitch.com, and Netlify