Giter Site home page Giter Site logo

Webview Serving about cordova-ios HOT 2 CLOSED

Sathyavathi2018 avatar Sathyavathi2018 commented on May 24, 2024
Webview Serving

from cordova-ios.

Comments (2)

Sathyavathi2018 avatar Sathyavathi2018 commented on May 24, 2024 1

@breautek : Thanks for the clear update. We can close this ticket.

from cordova-ios.

breautek avatar breautek commented on May 24, 2024

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.

<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.

from cordova-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.