Expose wry navigation_handler via WindowBuilder closes #4080 #5686
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___
)Other information
Rationale
Currently, it is difficult to use
tauri
for certain situations, for example, those involving OAuth redirects. This has been noted in issues #3020, #5411, and elsewhere.In some cases it is possible to find workarounds, such as by launching a local
warp
server and handlinglocalhost
redirects that way, but this is not always possible, particularly when the service in question uses deep linking and app-specific custom URI schemes.A simple way to address this problem is to allow handling of URL navigation events with a callback configured for the webview. This is already possible now with
wry
usingWebViewBuilder::with_navigation_handler
. However, as far as I could tell, there was no way to access this functionality fromwry
directly throughtauri
prior to this PR.This PR resolves that problem by allowing the user to set a navigation handler with
tauri::WindowBuilder
which then gets passed on towry
when the window is created via the runtime.