breautek commented on issue #1378:
URL: https://github.com/apache/cordova-ios/issues/1378#issuecomment-1754886876
> Is there any possibility for CORDOVA-IOS to be rendered as android. So, we
can ignore custom scheme?
By default iOS uses the `file://` protocol. A **better** protocol to use is
a custom scheme which can be controlled via `scheme` and `hostname`
preferences, however if you have an existing app already using the `file://`
protocol see the notes at the end.
```xml
<platform name="ios">
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
</platform>
```
But the caveat is the scheme cannot be set to any well known protocol that
`WKWebView` already binds, so that includes `http` or `https`, making it
impossible to have it configured identically as Android. Likewise, Android only
allows `http` or `https` in its equivilant API, making it impossible to make
Android behave like iOS in this regard.
Nonetheless, using non-file schemes on both platforms will resolve CORS
issue among device-local resources, with the exception that if you utilises
`cdvfile` or other `file` plugin resources in the DOM, you may need to refactor
to use a specific API to get a DOM-usable URL.
Communicating with a server will still result in CORS and that must be
resolved in the server-side configuration.
**IF you have an existing app** that is already using the `file://`
protocol, switching to a scheme-based protocol changes the "origin" of your
app. This means all your web storage containers (indexedDB, local storage,
cookies, etc) all gets a new container because they are all associated with an
origin. If that data is important and cannot be easily reconstructed, the old
data is still present, but inaccessible without having a plugin to migrate the
data from the old container into the new container.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]