My company is in the process of migrating our old Cordova app (non-Ionic) to Capacitor. As part of this we would like to migrate the values stored in localStorage
.
There’s a topic in the migration guide here: Capacitor - build cross platform apps with the web but I’m running into a problem. It seems like our Cordova app is being served from file://{some_path_into_the_filesystem}
both on Android and iOS (I checked that by inspecting our apps and getting the value of window.origin
).
In capacitor.config.ts
I tried to change the server.iosScheme
and server.androidScheme
to file
, but with no luck. When I build the Android app it simply crashes on startup with the error Not allowed to load local resource: file://localhost/
(see screenshot below).
The iOS app is not affected by this change (it serves from the default capacitor://
scheme).
Have any of you run into this problem?
Thanks a lot!