This plugin can be used in conjunction with
to persist LocalStorage data when migrating from
WKWebView. All related
files will be copied over automatically during startup so the user can simply pick up where they
How to use
Simply add the plugin to your cordova project via the cli:
cordoa plugin add cordova-plugin-migrate-localstorage
LocalStorage files are only copied over once and only if no LocalStorage data exists for
WKWebViewyet. This means that if you've run your app with
WKWebViewbefore this plugin will likely not work. To test if data is migrated over correctly:
- Delete the app from your emulator or device
- Remove the
- Run your app and store some data in LocalStorage
- Add both plugins back
- Run your app again. Your data should still be there!
Once the data is copied over, it is not being synced back to
UIWebViewso any changes done in
WKWebViewwill not persist should you ever move back to
UIWebView. If you have a problem with this, let us know in the issues section!
One of the drawbacks of migrating Cordova apps to
WKWebView is that LocalStorage data does
not persist between the two. Unfortunately,
does not offer a solution for this out of the box (see
https://issues.apache.org/jira/browse/CB-11974?jql=project %3D CB AND labels %3D wkwebview-known-issues).