But if I create a webview tab use the code below(CustomWebPage is a page contains a webview2 control,which will change tabitem header and create new tab dynamically),when I closed the tab, I could still hear the audio of the website playing, and the webview thread can still be seen in the task manager. I know there is a method called "CoreWebView2Controller.Close", but how can I call it? Or is there a simple way to close the tab and dispose(release) all the controls and resources used in it?
TabViewItem newItem = new TabViewItem();
newItem.Header = Title;
Frame frame = new Frame();
frame.Navigate(typeof(CustomWebPage), new CustomParameter(this, newItem,url));
newItem.Content = frame;
TabView.TabItems.Add(newItem);
TabView.SelectedIndex= TabView.TabItems.Count-1;
By the way, can I obtain the icon of website in webview2 without some complex and unreliable javascript(like the method in wpf: corewebview2.faviconuri)
Steps to reproduce the bug
create a window with a tabview
use method like above to create a tab with a webview2
Hey @IShiraiKurokoI, you can call WebView2.Close in your _TabsTabCloseRequested (that will, among other things, call CoreWebView2Controller.Close, and should synchronously stop web audio playback).
Describe the bug
The microsoft doc says use code below to close tab
But if I create a webview tab use the code below(CustomWebPage is a page contains a webview2 control,which will change tabitem header and create new tab dynamically),when I closed the tab, I could still hear the audio of the website playing, and the webview thread can still be seen in the task manager. I know there is a method called "CoreWebView2Controller.Close", but how can I call it? Or is there a simple way to close the tab and dispose(release) all the controls and resources used in it?
By the way, can I obtain the icon of website in webview2 without some complex and unreliable javascript(like the method in wpf: corewebview2.faviconuri)
Steps to reproduce the bug
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.2.3: 1.2.230118.102
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response