Closed sgehrman closed 2 months ago
Same issue in Hive
I've used hive in safari for a long time with no issue. Are you sure you're not in a private window or something?
hmm. I did a quick test and it does seem to work using your example. But my customers are saying things are not getting saved. Let me get more data... I don't use a mac, I'm on linux, so it's not easy to repo on my end.
Hey, I have a clue and wanted you to try it. My code is running in an iFrame. I'm wondering if Safari is blocking the iFrame from writing into the Indexed Database? It works in Chrome and Firefox, but maybe Safari is blocking this?
iFrames can be weird like that. Is it a headers issue maybe?
no idea. what headers issue?
Looks hopeless. It seems firebase users had a similar issue. https://github.com/firebase/firebase-js-sdk/issues/2393
Maybe you could print() a warning to the console if you detect a failure to open the indexedDB too.
Just to confirm, the original hive package has the same issue?
yeah.
I was wondering if hive used localstorage rather than indexedDB would that work?
I'm thinking of switching to shared_preferences instead of hive (if it works)
If localStorage did work, then an ideal solution would be something like:
if (indexedDBNotSupported) {
useLocalstorage();
} else {
useIndexedDB();
}
would that be easy to implement in hive_ce?
Do we know what causes Safari to not support indexed db in some cases? Shared preferences isn't meant to store large amounts of data, so performance may suffer depending on your use-case.
Yeah, Safari fails when opening indexedDB in an iframe. See that firebase link above
all my prefs are stored using hive. just strings, ints and bools. Nothing large.
If you're just storing app settings then shared preferences is the better solution anyways.
sure, the only problem is I already have linux/windows users and I would have to migrate everything over, but I'll have to deal with it.
Thanks.
I tried shared_preferences and that doesn't work in Safari either at least in my case where it's a browser extension that runs on localhost. It might work for a normal domain.
It works on Chrome and firefox, but no prefs are saved in Safari.