MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
441 stars 53 forks source link

[Problem/Bug]: Custom schemes don't work with the js fetch() api #4328

Open omegakode opened 7 months ago

omegakode commented 7 months ago

What happened?

I you register a custom scheme and try to use it with the js fetch() api you get an unauthorized error in js fetch('custom://dir/file.html');

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 10

OS Version

No response

Repro steps

Register a custom scheme and try to use it with fetch() js API

Repros in Edge Browser

Not Applicable

Regression

No, this never worked

Last working version (if regression)

No response

omegakode commented 7 months ago

Now i am not sure if this is directly related to the fetch api because if you register a custom scheme and try to load something like this (using virtual folders)

link rel="stylesheet" href="app://assets.com/style.css" script type="module" src="app://assets.com/scripts.js"

The stylesheet loads but the script doesn't because of the 'module' type, regular scripts load. The console throws 'Failed to load resource: the server responded with a status of 401 (Unauthorized)' The WebResourceRequested event never fires for the script module. Maybe has something to do with some Content Security Police? Any hints?

ray007 commented 7 months ago

What about XmlHttpRequest?