Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari 12 with Indexeddb, No available storage method found #914

Open
Hasan-git opened this issue Nov 15, 2019 · 5 comments
Open

Safari 12 with Indexeddb, No available storage method found #914

Hasan-git opened this issue Nov 15, 2019 · 5 comments

Comments

@Hasan-git
Copy link

Hasan-git commented Nov 15, 2019

Localforage returns no available storage method found on safari 12 and localforage@1.7.3 .
Actually, Indexeddb driver is must for me, so localStorage its not my option

   this.filesQueueStore = localforage.createInstance({
            name: "Uploads",
            storeName: "filesQueue",
            driver: [localforage.INDEXEDDB],
        });
@Hasan-git
Copy link
Author

Puzzling, that ('indexedDB' in window) and window.indexedDB detects indexeddb, and I have tried idb-keyval and its working as expected, while localforage doesn't detect indexeddb
any idea ?

image

@Jahrenski
Copy link

I have the same problem, running in WKWebview.
indexedDB is available in window but localForage doesn't detect it.

@d3r1w
Copy link

d3r1w commented Nov 30, 2019

Your problem is probably related to #856

@Jahrenski
Copy link

If you are using localForage in Ionic 4 with mobile support:

constructor( private platform: Platform, private device: Device ) {

  Promise.all([ this.platform.ready(), localForage.ready(), ]).then( () => {
    return localForage.getDriver(localForage.INDEXEDDB);
  }).then( driver => {

    //This hack makes a real device detection and forces it into a "custom" driver that is in fact a copy of the IndexedDB.
    if( this.platform.is('ios') && this.device && parseFloat( this.device.version ) >= 11.0 ) {

      const custom = Object.assign( true, driver, {
        _driver: 'customIndexedDB',
        _support: true
      });

      return localForage.defineDriver(custom);
    }
  });
}

@mantovanigo
Copy link

Jahrenski's workaround was basically the only solution that worked for me on Ionic 5 and Safari mobile (both new and old versions). I've been trying tricks the whole day...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants