Cordova-plugin-ionic-webview: Upgrading webview and local storage

Created on 9 Oct 2017  路  3Comments  路  Source: ionic-team/cordova-plugin-ionic-webview

From my understanding, it seems since UIWebView and WKWebview are different environments, local storage is not preserved when switching from one webview to another.

This would be ok for apps not yet in production, but for apps that already have thousands of customers, this is a huge compromise. This means that any customer rolling over to the new webview would lose their local storage data and hence lose their settings and login data.

Would there be a way to smoothly transition by transferring local storage data from the old webview to the new, or would my users be forced to go back to a blank slate as they update their app?

Most helpful comment

Thanks for the suggestion but an intermediate step wasn't really the most ideal solution (since a lot of users are known to skip updates--or even never update).

Instead, I've adapted this plugin to the ionic-webview plugin.

https://github.com/MaKleSoft/cordova-plugin-migrate-localstorage (this was meant to work with cordova-plugin-wkwebview-engine instead).

Here's the link to my solution in case anyone has the same problem migrating LocalStorage. For good measure, I also decided to migrate IndexedDB files:

https://github.com/jairemix/cordova-plugin-migrate-localstorage

All 3 comments

You could release an update still with uiwebview that moves the data into SQLite data Store, this can be accessed from both web views. Add a migration step into your first release with wk to move the data back to local storage or just keep using sqlite.

Thanks for the suggestion but an intermediate step wasn't really the most ideal solution (since a lot of users are known to skip updates--or even never update).

Instead, I've adapted this plugin to the ionic-webview plugin.

https://github.com/MaKleSoft/cordova-plugin-migrate-localstorage (this was meant to work with cordova-plugin-wkwebview-engine instead).

Here's the link to my solution in case anyone has the same problem migrating LocalStorage. For good measure, I also decided to migrate IndexedDB files:

https://github.com/jairemix/cordova-plugin-migrate-localstorage

Also https://github.com/paulpatarinski/cordova-plugin-migrate-localstorage now on npm as well

cordova plugin add cordova-plugin-ionic-migrate-localstorage
Was this page helpful?
0 / 5 - 0 ratings

Related issues

acollazomayer picture acollazomayer  路  3Comments

BorntraegerMarc picture BorntraegerMarc  路  5Comments

jamesdixon picture jamesdixon  路  4Comments

FarhadG picture FarhadG  路  6Comments

paulstelzer picture paulstelzer  路  8Comments