Im building a WPF app and i'm trying to check several URL's in the background within a WebView2 window
Altough some urls have popups (which aren't real popups) in the upper left corner like asking for permission to use e.g. the microphone or something.
These popups are getting displayed in full size even if the visibility of the 1x1 pixel big webview is hidden
Here is an example of such a popup in my app:
The black corner is the edge of the app and as you can see the meet.google.com popup is displayed in full size even if the webview is invisible
I already tried to disable the notifications with the new window requested event but this doesn't work because it isn't a new window and it doesn't have a URL or anything.
I also tested many CoreWebView2 settings which made sense,like before no useful results
Does somebody know if there is a setting or something which i have to enable/disable in WebView2 to disable these notifications?
If any further information is required please ask me!
CodePudding user response:
You need to look at the Permissions Requested event for mic and camera.
async private void InitializeWebView2()
{
await webView21.EnsureCoreWebView2Async();
webView21.CoreWebView2.PermissionRequested = CoreWebView2_PermissionRequested;
}
private void CoreWebView2_PermissionRequested(object sender, CoreWebView2PermissionRequestedEventArgs e)
{
Debug.WriteLine(e.PermissionKind.ToString());
e.State = CoreWebView2PermissionState.Allow;
}