Indexeddb not working on iPhone IOS 8 from web app
window.indexedDB on both the Home Screen and the Cordova web app on iOS 8 is null. And yet - only readable. So indexedDBShim also failed ...
The approach with window._indexedDB ( https://github.com/axemclion/IndexedDBShim/issues/167 ) works for me ...
source to share
IndexedDB is half supported for cordova! They only have a read-only database (totally useless) But you can do a workaround using a polyfill like Polyfill Indexeddb
The polyfill problem in ios8 case is that indexdb shim detects that indexdb is installed, but not knowing that they are read-only version, they use window.indexdb, not shim. Therefore, you must force indexshim instead of window.indexeddb.
Open the refill code to find the code block:
if ((typeof window.indexedDB === "undefined" || poorIndexedDbSupport) && typeof window.openDatabase !== "undefined") {
window.shimIndexedDB.__useShim();
}
else {
window.IDBDatabase = window.IDBDatabase || window.webkitIDBDatabase;
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction;
window.IDBCursor = window.IDBCursor || window.webkitIDBCursor;
window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
if(!window.IDBTransaction){
window.IDBTransaction = {};
}
/* Some browsers (e.g. Chrome 18 on Android) support IndexedDb but do not allow writing of these properties */
try {
window.IDBTransaction.READ_ONLY = window.IDBTransaction.READ_ONLY || "readonly";
window.IDBTransaction.READ_WRITE = window.IDBTransaction.READ_WRITE || "readwrite";
} catch (e) {}
}
and replace with:
window.shimIndexedDB.__useShim();
you can use indexedDB with window.shimIndexedDB
source to share