I know that IndexedDB implementation in iOS is quite buggy, like the shared ids between different tables. However it is not working at all for me. I am trying to develop a Cordova app for iOS that should use IndexedDB, so I created the following code:
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;
window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
var request = window.indexedDB.open("mydata"); //also tried open("mydata", 1) with same result
console.log('OPEN DB')
request.onupgradeneeded = function() {...};
request.onsuccess = function() {...};
When running this snippet in the Cordova app, the OPEN DB print is not shown, the execution gets stuck at the indexedDB.open call (no error log or anything at all). I thought this may be a Cordova issue so I decided to run the same code in plain Safari browser although it should be the same as Cordova is just using a UIWebview that, to my understanding, should be using the same webkit version as the browser.
When running in Safari iOS 8.1.1 the OPEN DB log is printed but it crashes on the next line due to request variable being null. When running on iOS 8.1.2 it crashes on the open() call showing a log saying:
SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent
What the $@#%! is going on? I see some people complaining about buggy behaviour but I can't even open the DB, is this normal or what?
sadly indexedDB isn't supported by the UIWebView
http://www.sencha.com/blog/apple-shows-love-for-html5-with-ios-8
IndexedDB was added to iOS 8 Safari and “WKWebView”
IndexedDB is not available in iOS 8 “UIWebView” or Home screen apps
But you can try with the WKWebView cordova plugin http://devgirl.org/2014/11/10/boost-your-ios-8-mobile-app-performance-with-wkwebview/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With