Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7991 WKWebView integration
  3. CB-7348

[WKWebView] pages that are loaded using file:/// urls respect CORS

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • cordova-ios
    • iOS 8

    Description

      Not a complaint but an advisory, this is the opposite of what happens in a UIWebView, where a page loaded locally is not restricted to CORS and can do whatever it wants.

      Try xhr to a local server using: https://gist.github.com/enjalot/2904124

      Note that it works with the wildcard of course. By default, file:// urls give the Origin: header as null.

      The only solution is, the destination server MUST return the header "Access-Control-Allow-Origin" that matches the wildcard or "null".

      So what is the alternative? Run a local proxy. The PhoneGap Developer App does this transparently: https://github.com/phonegap/phonegap-app-developer by overriding XMLHttpRequest.open

      Attachments

        Activity

          People

            shazron Shazron Abdullah
            shazron Shazron Abdullah
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: