Skip to content

Add WebView2 best practices folder with UWP guide#5599

Open
chetanpandey1266 wants to merge 3 commits into
mainfrom
user/chetanpandey/uwp-best-practices
Open

Add WebView2 best practices folder with UWP guide#5599
chetanpandey1266 wants to merge 3 commits into
mainfrom
user/chetanpandey/uwp-best-practices

Conversation

@chetanpandey1266
Copy link
Copy Markdown
Contributor

Introduces a best-practices/ folder with a README and an initial UWP best practices document covering controller shutdown and external URI scheme handling.

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md to describe the purpose/format of best-practice entries and contribution expectations.
  • Adds an initial uwp-best-practices.md covering controller shutdown (CoreWebView2Controller.Close()) and handling external URI schemes via LaunchingExternalUriScheme.

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 thread best-practices/uwp-best-practices.md Outdated
Comment on lines +20 to +21
void App::OnClosed()
{
Comment thread best-practices/uwp-best-practices.md Outdated
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));
};
Chetan Pandey and others added 2 commits May 20, 2026 15:17
… launches

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants