Add WebView2 best practices folder with UWP guide#5599
Open
chetanpandey1266 wants to merge 3 commits into
Open
Add WebView2 best practices folder with UWP guide#5599chetanpandey1266 wants to merge 3 commits into
chetanpandey1266 wants to merge 3 commits into
Conversation
Introduces a best-practices/ folder with a README and an initial UWP best practices document covering controller shutdown and external URI scheme handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new best-practices/ documentation area intended to capture practical, API-level guidance for WebView2 hosts, starting with a UWP-focused guide.
Changes:
- Introduces
best-practices/README.mdto describe the purpose/format of best-practice entries and contribution expectations. - Adds an initial
uwp-best-practices.mdcovering controller shutdown (CoreWebView2Controller.Close()) and handling external URI schemes viaLaunchingExternalUriScheme.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| best-practices/uwp-best-practices.md | New UWP guide with lifecycle and external URI scheme handling recommendations. |
| best-practices/README.md | New index/overview for the best-practices documentation folder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+21
| void App::OnClosed() | ||
| { |
Comment on lines
+32
to
+33
| // C# | ||
| private void OnClosed(object sender, WindowEventArgs e) |
|
|
||
| Without an explicit `Close()`, the WebView2 instance is torn down without | ||
| going through the normal browser shutdown procedure. As a result, state such | ||
| as cookies is not flushed correctly, which can lead to data loss or |
Comment on lines
+61
to
+67
| ```csharp | ||
| // C# | ||
| _webView.CoreWebView2.LaunchingExternalUriScheme += async (s, e) => | ||
| { | ||
| e.Cancel = true; | ||
| await Windows.System.Launcher.LaunchUriAsync(new Uri(e.Uri)); | ||
| }; |
… launches Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduces a best-practices/ folder with a README and an initial UWP best practices document covering controller shutdown and external URI scheme handling.