question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

origin is null for requests sent with window.fetch on WKWebView engine

See original GitHub issue

Issue Type

  • Bug Report
  • Feature Request
  • Support Question

Description

I’m attempting to upgrade cordova-ios from 5.1.1 to 6.0.0 for a project. At the same time, I’m also trying to migrate from uiwebview to wkwebview since that’s the new default. And uiwebview is going to be deprecated anyways.

Following the release note, I’ve managed to get the standard xhr working by setting the scheme and hostname preferences in config.xml

However the requests sent with window.fetch still have the origin set to null despite the custom scheme configuration.

Is that the expected behavior, and I will have to migrate to some other plugin to replace the window.fetch functionality? Is there something else that I’m missing?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
micro-sugarcommented, Oct 27, 2020

in CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m after WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init]; add [configuration setValue:@"TRUE" forKey:@"allowUniversalAccessFromFileURLs"]; can fix api fail

2reactions
gaollardcommented, Nov 7, 2020

Same problem when the axios is used.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WKWebview Origin null is not allowed by Access-Control ...
The underlying problem is that WKWebview expects local files to respect CORS as well, and basically you need to tell it to ignore...
Read more >
apps for iOS: switching to WKWebView - SAP Blogs
In this Cordova version UIWebView has been completely removed and we no longer need to use the wkwebview-engine plugin and some of the ......
Read more >
WKWebView needs feature to allow file:// subresources
The error I'm getting when trying to communicate between the main window and a local iframe is: Blocked a frame with origin "null"...
Read more >
Blog - Apache Cordova
Deprecation of the Cordova WKWebView Engine Plugin ... are instead opened in the same webview as if they had not requested a new...
Read more >
Breaking and Fixing Origin-Based Access Control in Hybrid ...
First, it provides an embedded Web browser (for example, WebView on Android) ... By default, PhoneGap-based Android apps request from the user and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found