-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Document iOS WKWebView problems and workarounds #5079
Comments
BTW the way to fix this issue is pretty easy: just go to http://pouchdb.com/errors.html, click the pencil, and add a new section! Ideally it should go somewhere near the top because I bet a lot of people are going to run into this. |
Also note I don't recommend SQLite Plugin 1 anymore because we couldn't keep up with breaking changes, but I'm happy to mention it for folks who need features lacking in SQLite Plugin 2 (e.g. encrypted databases). |
I do want to add to this. Even though WKWebview is usable through cordova, it still isn't a default in Cordova. Most users who report using WKWebview either are using the WKWebView from telerik or the very experimental cordova wkwebview. Both of which need a small server running to be able to do anything with modern JS frameworks and both of which suffer from issues due with the web views limitations. Not taking away form anything, just clarifying the point about cordova/ionic. |
Ah interesting, I assumed it was recommended at this point, given the large number of issues we see filed about it. For the fileserver issue, though: I thought the |
Ah nevermind, read a bit more in the README:
Yikes. 😓 |
Yeah, thats the big problem with WKWebview for us right now. |
This has been fixed in WebKit master and should be available in the next version of iOS. So it's probably pointless to add any documentation about this; anyone interested in the bug will hopefully find this Github issue or other resources to answer their question. WebKit issue: https://bugs.webkit.org/show_bug.cgi?id=137760 |
@mhartington It seems as though this is the default for Cordova OSX also? Which I assume is using WKWebview by default? |
Interestingly I have the DOM Exception 18 on Safari on OS X (El Capitan) when browsing to a url that had a FRAME FORWARD to the actual hosted site.... changing the forward to a normal (header) redirect fixed the issue |
Getting this when doing (pouchdb ver 5.4.5)
|
@ozexpert WKWebView will not support WebSQL until Safari 10. You must use the SQLite Plugin, this is also recommended: http://github.com/nolanlawson/pouchdb-adapter-cordova-sqlite |
@nolanlawson In Ionic 1 + PouchDB 5.4.5 + iOS + WKWebView plugin, I'm trying: 2 - Then, I downloaded the pouchdb.cordova-sqlite.js from https://npmcdn.com/pouchdb-adapter-cordova-sqlite/dist/pouchdb.cordova-sqlite.js and include this js in my index.html:<script src="lib/cordova-plugin-sqlite-2/dist/pouchdb.cordova-sqlite.js"></script> I have a database > 35mb, and without cordova-plugin-sqlite-2 I get the error of space when I synchronizing. |
@fabionpinheiro I think you experience the same issue that I had. Which is that the sqlite js file is loaded after angular, pouchdb etc. |
@guyromb I've tried many ways:
2 -
Can you send me an example? From index.html order import and app.js with Pouch Instance like "var localDB = new PouchDB("local.db", {adapter: 'websql'});" |
@fabionpinheiro It's not enough to just include the script tag. You have to also explicitly register the plugin. See "not using npm?" under here: https://github.com/nolanlawson/pouchdb-adapter-cordova-sqlite#usage |
@nolanlawson I must include both in index.htlm? Ex:
Can I put the PouchDB.plugin(PouchAdapterCordovaSqlite) inside $ionicPlatform.ready(function() {... ? Is there a detailed example ? |
You can put PouchDB.plugin(...) anywhere, yeah. I didn't create a sample app, no, but basically: <script src="lib/pouch-db/sqlite-plugin.js"></script>
<script src="lib/pouch-db/pouchdb.cordova-sqlite.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="lib/pouch-db/pouchdb-5.4.5.js"></script>
<script>
PouchDB.plugin(PouchAdapterCordovaSqlite);
var db = new PouchDB('foo.db', {adapter: "cordova-sqlite"});
</script> |
@nolanlawson Thanks for help, now it's working! The right is (ionic 1):
2 - Create the PouchDB instance in $ionicPlatform.ready inside your controller (
3 - Now, I can download and work with my PouchDB >50mb in iOS perfectly. |
(Follow-up to #5078.) We need to add this to the list of common errors, because it's going to affect everybody who's using Cordova these days.
Facts: DOM Exception 18 is thrown when trying to access WebSQL in two cases:
Facts: WKWebView is now recommended in Cordova, and is commonly in use as of Cordova 4+ due to the performance boost relative to UIWebView. This also applies to Ionic/PhoneGap/etc.
Fact: WKWebView is now also used in Chrome, Firefox, and Opera for iOS, since they are not truly separate browsers but are instead wrappers around WKWebView.
The only workarounds for PouchDB as of right now are:
If somebody would take this braindump of information and convert it into a readable section in the "common errors," I would be eternally grateful!
The text was updated successfully, but these errors were encountered: