tryphotino / photino.Samples

https://tryphotino.io
Apache License 2.0
103 stars 27 forks source link

Custom Scheme "app" is not working #42

Closed andreasmo closed 1 year ago

andreasmo commented 1 year ago

It just took me a while to find out that for RegisterCustomSchemeHandler to work in current versions of edge one needs to use an allowed scheme. ("web+schemename" or one of the predefined schemes) See https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler#permitted_schemes

This should be changed in samples and also be reflected in the documentation (and perhaps even raise a runtime error?).

ottodobretsberger commented 1 year ago

To our knowledge this is not a problem. Would you mind sharing information about your setup, environment, OS, etc? Are you using the stock samples or some custom project? So we can try to replicate the issue you are mentioning.

andreasmo commented 1 year ago

I used the virtually unchanged Visual Studio Angular Template (see attached zipped project below). I do not get the "Dynamically inserted JavaScript" alert when using "app" as custom scheme. When changing "app" to "web+app" (both in Program.cs and index.html) it works! Windows 11 Version 10.0.22621 Build 22621 WebView2 Runtime 114.0.1823.43 SampleProject.zip

philippjbauer commented 1 year ago

I'm not quite sure where the problem lies still.

I am running a fresh install of Windows 11 Pro (x86/64), same build, latest updates, Runtime 114.0.1823.55.

I downloaded your sample and was able to run it, the alert opens automatically as expected:

Screenshot 2023-06-22 at 11 29 58 AM
andreasmo commented 1 year ago

I just tried again and it is working now for me as well. (Windows Update ran a few days ago and I now have a different WebView2 Runtime (114.0.1823.51), so this might have fixed it). On the other hand the Spec is clear that one should only use the whitelisted schemes or web+ prefixed ones. https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-registerprotocolhandler Therefore I will only use web+ prefixed Schemes. Nonetheless thanks for looking into this.