'Disabling Security in TEdgeBrowser

I've seen examples in C# where people disabled security (so the user doesn't have to click continue on cert errors) in WebView2 by changing the CoreWebView2EnvironmentOptions, but I can't for the life of me figure out how to do the equivalent with the TEdgeBrowser component in Delphi. Has anyone managed to achieve this in Delphi?

Edit: Updated with a C# solution.

 async void InitializeAsync()
        {
            var op = new CoreWebView2EnvironmentOptions("--disable-web-security");
            var env = await CoreWebView2Environment.CreateAsync(null, null, op);
            await webView.EnsureCoreWebView2Async(env);
        }

Another work around in C#:

var result = await webView.CoreWebView2.CallDevToolsProtocolMethodAsync("Security.setIgnoreCertificateErrors", "{\"ignore\": true}"); 


Solution 1:[1]

Unfortunatelly, Delphi 11.1 still does not offer a nice way to control the CoreWebView2EnvironmentOptions.

Instead, you could do this using WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS environement variable:

SetEnvironmentVariable('WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS',
  '--ignore-certificate-errors');
EdgeBrowser.CreateWebView;

Note, --disable-web-security will not remove certificate warnings, but --ignore-certificate-errors will do the trick.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcodor