Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Devtools in Microsoft.Web.WebView2.Wpf component

Tags:

webview2

I want to disable devtools from Webview2 component in wpf application .net5. Please help me how to do it?

like image 260
Min Avatar asked Mar 02 '23 20:03

Min


1 Answers

That is easy, after the WebView2 has been initialized.

Simply do:

webView21.CoreWebView2.Settings.AreDevToolsEnabled = false;

where 'webView21' is the name of the WebView2 control.

You can see all settings here: CoreWebView2Settings Class Definition

like image 99
Poul Bak Avatar answered Mar 07 '23 10:03

Poul Bak