bug: iosScheme 'file' is not used as origin
See original GitHub issueBug Report
Capacitor Version
npx cap doctor
output:
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 1.4.0
@capacitor/core: 1.4.0
@capacitor/android: 1.4.0
@capacitor/ios: 1.4.0
Installed Dependencies:
@capacitor/cli 1.3.0
@capacitor/core 1.4.0
@capacitor/ios 1.4.0
@capacitor/android 1.4.0
[success] Android looking great! 👌
Found 0 Capacitor plugins for ios:
[success] iOS looking great! 👌
Affected Platform(s)
- Android
- iOS
- Electron
- Web
Current Behavior
When migrating from a vanilla Cordova application (non-Ionic) to Capacitor, the device loses all localStorage and indexedDB data that is bound to the origin scheme.
Cordova binds these resources to the file://
scheme by default. Inside the IOS file storage these can still be found inside the WebKit cache under the IndexedDB file__0
directory.
However, when file
is used as the scheme, it does not override the capacitor
scheme that is used.
"server": {
"iosScheme": "file"
}
Expected Behavior
Setting iosScheme
to file, binds the apps resources to the file://
origin and allows users to migrate from a vanilla Cordova app to a Capacitor app.
Sample Code or Sample Application Repo
Reproduction Steps
Other Technical Details
npm --version
output:
node --version
output:
pod --version
output (iOS issues only):
Other Information
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
WebView origin not correctly set when using custom scheme ...
Implementations can set different origins for "file" and unknown schemes, but my "ionic" scheme is known to the WebView. Do you think this...
Read more >cordova-plugin-ionic-webview - custom scheme not working ...
NOTE: This config works fine on iOS. On Android I can't use this plugin due to this Hostname/Origin issue.
Read more >cordova-handle-ssl-error - npm
A Web View plugin for Cordova, focused on providing the highest performance experience for Ionic apps (but can be used with any Cordova...
Read more >Capacitor Configuration | Capacitor Documentation
The Capacitor configuration file is used to set high-level options for Capacitor tooling. Example. This is an example capacitor.config.ts file: import { ...
Read more >Config.xml - Apache Cordova
When using the CLI to build a project, versions of this file are passively copied into various platforms/ subdirectories. For example:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those interested. We achieved an IOS IndexedDB migration using the capacitor
FileSystem
plugin.Example.
For Android, Google’s implementation of LevelDB makes it a little difficult to copy the cached files.
https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/181#issuecomment-516602506
From the comments, one option is to open up a WebView on the old scheme and copy the data across.
Example gist
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.