Open inf9144 opened 11 months ago
So the problem is that on Windows, custom protocols are not really custom protocols and we need to use a workaround, and the actual URL for wry://path/to/page
is https://wry.path/to/page
.
@wusyong do you think we should fix the URL before passing to these closures or always allow these navigations? what is the behavior of these colsures on other platforms?
@wusyong do you think we should fix the URL before passing to these closures or always allow these navigations? what is the behavior of these colsures on other platforms?
I think handling this ourselves will be a little more complicated. Not saying it's not it can be, but I guess we can mention this difference in doc comment first. And if anyone would like to open a PR to fix it, we can address the change at that time.
@wusyong does with_on_page_load_handler
and with_navigation_handler
trigger for custom protocols on macOS and Linux?
So the problem is that on Windows, custom protocols are not really custom protocols and we need to use a workaround, and the actual URL for
wry://path/to/page
ishttps://wry.path/to/page
.@wusyong do you think we should fix the URL before passing to these closures or always allow these navigations? what is the behavior of these colsures on other platforms?
Does anyone actually know why this is the case? The web has always been perfectly cross-platform up until this, what's the difference?
Does anyone actually know why this is the case? The web has always been perfectly cross-platform up until this, what's the difference?
WebView2 simply didn't have any APIs that would allow us to register custom schemes until somewhat recently. This wasn't really a limitation of "the web" or even the engine but simply of the webview wrapper. Nowadays it does have the APIs but they were added after they dropped win7/8 support so i think we're waiting until we drop win7/8 support too to switch from http(s) to custom schemes.
Does anyone actually know why this is the case? The web has always been perfectly cross-platform up until this, what's the difference?
WebView2 simply didn't have any APIs that would allow us to register custom schemes until somewhat recently. This wasn't really a limitation of "the web" or even the engine but simply of the webview wrapper. Nowadays it does have the APIs but they were added after they dropped win7/8 support so i think we're waiting until we drop win7/8 support too to switch from http(s) to custom schemes.
Ah sick well I hope this gets merged soon. Lemme know if I can contribute anything
Describe the bug If you register a custom protocol on the builder ("with_asynchronous_custom_protocol") (e.g. "app") you get wrong urls on handlers for navigation ("with_navigation_handler") and page load ("with_on_page_load_handler") on Windows . For an adress like "app://localhost" you receive "https://app.localhost" on your handlers. It happens no matter if you use "with_https_scheme" or not.
Steps To Reproduce Register a custom protocol handler and a navigation handler on windows and open a custom protocol address:
Expected behavior Receive a value ""app://localhost"" instead of "https://app.localhost"
Platform and Versions (please complete the following information): OS: Windows Rustc: Newest