For apps currently using cordova-plugin-ionic-webview (v4) and planning to migrate to Capacitor, the saved local storage data will get lost due to different default origins.
From cordova-plugin-ionic-webview documentation:
The default origin for requests from the Android WebView is
http://localhost
.
The default origin for requests from the iOS WebView is
ionic://localhost
From Capacitor documentation:
For example, apps running in Capacitor have
capacitor://localhost
(iOS) orhttp://localhost
(Android) as their origin.
What is the best way to handle this migration? Can we change the origin for Capacitor to match what we have in cordova plugin, or is it better to configure the cordova plugin ‘now’ to use whatever Capacitor will want to use ‘later’ (at least apps not in production yet)?
cordova-plugin-ionic-webview documentation allows configuring origin, but couldn’t find something similar in Capacitor docs. It will also help if a section is added to Migration guide at Cordova to Capacitor Migration | Capacitor Documentation
Best would be to have default origins same for Capacitor and cordova-plugin-ionic-webview, but that will break existing apps.