Michael S.
Michael S.

Reputation: 63

Modernizr detection of IndexedDB in iOS-Simulator

Inside my app I use Modernizr to detect various features. To detect if IndexedDB is available I use "Modernizr.indexeddb". In the iOS Simulator (v8.1) it returns false! (It should return true, because IndexedDB is available since iOS 8.0 - nevertheless it's buggy behavior).

(The app uses AngularJS, MobileAngularUI and jQuery, but this not-related to the issue I think.)

I checked the same app in the Desktop-Safari and Chrome: Modernizr.indexeddb returns true.

I re-checked if indexedDB is supported on this device with this website: https://www.browserleaks.com/modernizr - It shows that IndexedDB is supported inside the simulator's Safari Browser.

To be sure that I'm running the latest version of Modernizr I re-downloaded Modernizr from this URL: http://modernizr.com/downloads/modernizr-latest.js

Edit: This Pluker contains a button where you can check the output of Modernizr.indexeddb. I tested this on my iOS8.1 device, and on the 8.1 iOS Simulator. On both devices the return value was true!

The button triggers that function:

function checkIndexedDB() {
  alert('Modernizr.indexeddb = ' + Modernizr.indexeddb);
};

Why does my app (that runs in the cordova-container) has no indexeddb available?

Upvotes: 1

Views: 499

Answers (1)

Michael S.
Michael S.

Reputation: 63

I found the answer - IndexedDB is not available inside Cordova-Applications. (state today: 31. October '14)

In iOS8 a new component WKWebView has been introduced. Cordova still uses the old UIWebView component. They want to switch to the new WKWebView, but there are some bugs apple has to solve:

Unfortunately there is a serious bug in WKWebView where it can’t load file:// urls, so it has hampered our efforts. This functionality was working in iOS 8 betas 1 to 3 on the device (it always works in the iOS 8 Simulator), but broken after that. I’m not sure what the ETA for the bug fix is, but it is in Apple’s radar (literally!).

See this for more infos: Does iOS 8 support IndexedDB with UIWebView?

Upvotes: 3

Related Questions