localStorage, IndexedDB and cookies belong to an origin: scheme, host and port. The note typed into the Cordova 129 app lives under the Cordova app's origin, and the migrated app can read it only if it loads from the same one. On Android that works by default: cordova-android 10 and later serve from https://localhost, Capacitor 243,123 's Android default too (Local Schemes), and the note survived the update (Removing Cordova). Changing the scheme proves the point. With "server": { "androidScheme": "http" } in capacitor.config.json, a rebuild and a reinstall:
> location.origin
"http://localhost"
> localStorage.getItem('note')
null
> localStorage.length
0Reverting the setting brought the note back: it had only been filed under another origin. iOS is where migrations usually lose data. A Cordova iOS app loads from file:// unless config.xml sets the scheme preference, and an Ionic-Cordova app uses ionic://localhost from cordova-plugin-ionic-webview, while Capacitor uses capacitor://localhost. The migration guide's fix for Ionic 20,753 apps is "server": { "iosScheme": "ionic" }. An app that loaded from file:// cannot keep its origin, and neither can an Android build from cordova-android 9 or older, or one with AndroidInsecureFileModeEnabled. For those, have a last Cordova release copy the data into native storage that ignores origins, such as cordova-plugin-nativestorage, whose data Capacitor's Preferences plugin reads with configure({ group: 'NativeStorage' }) (Preferences).