-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebResourceRequest is not executed for custom URI schemes in <iframe> #173
Comments
Yes, we don't support custom URI schemes whether in an iframe or otherwise. If you know the iframe you could cancel the navigation and then inject script to navigate the iframe to a file URI. But the navigation event doesn't have an indication of which iframe so you would need to know that on your own somehow. |
Ok.. I think it would be important to support custom URI schemes. |
Any update? Is the support planned in the near future? |
Support is planned, but probably not for another couple releases. |
Are you mostly using this for easy access of local file resources? If so we have a feature releasing sooner that may help. Details here: https://github.com/MicrosoftEdge/WebView2Feedback/blob/master/specs/HostResourceMapping.md |
No, I want to use the custom URIs to parse them and poll the corresponding resources from a database. |
+1 for custom protocol scheme support. |
@champnic Just want to check if this is on the radar. I see that the VirtualHosting API is now promoted to stable in the latest prerelease (1.0.781-prerelease) so I will start working with that first, but please see the above comment on why I'd still prefer a custom scheme handler. FWIW, our previous implementation in CEF used CefSchemeRegistrar::AddCustomScheme to register a scheme handler and CefStreamReader::CreateForFile to provide the resource stream when the handler was called |
Hey @romanan - yes this is still on our radar, and relatively high priority on our backlog right now. |
Great news, thanks! |
Yes, very good that this issue is being addressed! |
Thanks everyone for the feedback, we are starting to look into custom URI schemes again. Would this provide the support you are looking for, for custom URI schemes? If this event/handler was provided would you still need WebResourceRequested to fire for custom URI schemes? Thanks. |
What I would like to see in custom URI schemes is something like RegisterNameSpace from the old mshtml/ie api. This function lets you associate a scheme with an IInternetProtocol object. (There are a few steps in between that I've left out, but that's the basic idea.) The net result is that if I register the scheme "mycustomprotocol" in an application, when an mshtml object in my application trues to load content with a url such as "mycustomprotocol://mycustompage.html", it then call the read method for the associated IInternetProtocol object. The read method of that IInternetProtocol will be implemented to serve the content back to the mshtml object in whetever manner is appropriate for the application. This was a very useful feature with the old api. Would handling the UnsupportedUriSchemeIdentified Event (or whetever the name ends up being) let you do something like this in the webview2 system? |
Hi folks! As @maurawinstanley mentioned we're currently working on custom protocol and it will looks similar to EdgeHTML's equivalent feature where you get an event when webview2 encounters an unrecognized protocol, and you can handle the event as appropriate. There area few things that planned to be exposed in the event handler -
Would love some feedback on whether approach solves your scenario and whether these info is enough or developers would want access to additional information/parameter as well in the event handler. |
As in issue #172 (comment of wusyong), perhaps it would be best to have the same properties as in CoreWebView2WebResourceRequestedEventArgs |
@MarkusSchreiner thanks for the input, we are planning on having this event fire separately with these event args, and the WebResourceRequested event we are planning to have fire for custom URI schemes in the future. For this event separate of WebResourceRequested do these event args fit your scenario or are there additional ones you would like to see? |
@champnic @maurawinstanley Any update on this? |
A near future prerelease SDK should have it as an experimental API. |
This has shipped and should also work in iframes. see #172 (comment) Thanks! |
I have found the same problem with custom URI schemes as in issue #172 when they are used in an iframe:
example:
<iframe src="myProt:*AnotherPage.html"></iframe>
Also in this case the WebResourceRequest is not executed; setting the switches
--allow-file-access-from-files
and/or
--disable-web-security
does not help at this point.
Although I can intercept the loading of this frame with the ICoreWebView2NavigationStartingEventHandler, but I have no possibility to convert the URI into a corresponding real path; in this callback I don't have access to a any Response-object.
Any suggestion for this case?
AB#27223790
The text was updated successfully, but these errors were encountered: