


Options.AdditionalBrowserArguments &= " -enable-features=WebRtcHideLocalIpsWithMdns"ĭim env As CoreWebView2Environment = Await CoreWebView2Environment.CreateAsync(Nothing, Nothing, Options) ' Prevent WebRTC leaks of local IP addresses If Proxy "" Then Options.AdditionalBrowserArguments = "-proxy-server=" & Proxy ' Force the traffic through a proxy server? Dim TargetURL As String = ""ĭim WV As .WebView2 = New .WebView2ĪddHandler WV.NavigationCompleted, AddressOf WV_NavigationCompletedĭim Options As CoreWebView2EnvironmentOptions = New CoreWebView2EnvironmentOptions() You can also use this following code to prevent LocalIP leaks (which should be blocked by default these days) and to force WebView2 traffic through a proxy server of your choice.

The same code works perfectly for Edge: Dim RegKey = My.("Software\Policies\Microsoft\Edge") If ("WebView2") Then RegKey.DeleteSubKey("WebView2") I run the following code on form close to clean up Dim RegKey = My.("Software\Policies\Microsoft\Edge") RegKey.SetValue("WebRtcLocalhostIpHandling", "disable_non_proxied_udp", ) Dim RegKey = My.("Software\Policies\Microsoft\Edge\WebView2") Setting the WebRtcLocalhostIpHandling registry key to disable_non_proxied_udp will prevent the IP from being leaked. This can be done at LocalMachine or CurrentUser Level. The simplest way to kill off WebRTC leaks in WebView2 is to change the policy in the registry when your app first starts up. This code demonstrates how to use WebView2 with an anonymous proxy and to prevent WebRTC leaks. I'm using Microsoft Edge with version 80.0.315.0 (Official build) canary (64-bit) on a Window 10. The above args won't work in the API CreateWebView2EnvironmentWithDetails(nullptr, nullptr, args, callback_handler) WCHAR args = TEXT("-edge-webview-switches=-disable-webrtc-hide-local-ips-with-mdns") WCHAR args = TEXT("-edge-webview-switches=-enable-webrtc-hide-local-ips-with-mdns=0") WCHAR args = TEXT("-edge-webview-switches=\"-enable-webrtc-hide-local-ips-with-mdns=0\"") WCHAR args = TEXT("-disable-webrtc-hide-local-ips-with-mdns") WCHAR args = TEXT("-enable-webrtc-hide-local-ips-with-mdns=0") I've tried the following values which don't work at all. I want to change the value of edge://flags/#enable-webrtc-hide-local-ips-with-mdns flag from 'Default' to 'Disabled'.Īccording to the MSDN doc, the API CreateWebView2EnvironmentWithDetails has an argument additionalBrowserArguments which can change chromium flags. I'm developing WebRTC application using Microsoft Edge WebView2.
