Closed TidyScript closed 3 years ago
等同于下面的代码: var op = new CoreWebView2EnvironmentOptions("--disable-web-security"); var env = await CoreWebView2Environment.CreateAsync(null, null, op); await edge.EnsureCoreWebView2Async(env);
If I understand correctly you found a workaround for this issue. Disabling web security is not something we want to encourage and so won't expose this in a simpler API. Thanks!
We have same requirement, and we are using WinUi3, but unfortunately there is no env parameter in EnsureCoreWebView2Async signature. https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.webview2.ensurecorewebview2async?view=winui-3.0
Hey @ilovepumpkin - for WinUI 3 and WinUI 2 controls, you should be able to use the WEBVIEW2_ADDITIONAL_BROWSER_ARGS
environment variable to set the browser args before initializing the WebView2. You can set that variable from within your app. Thanks!
如题。 由于总是遇到同源策略的阻止问题,所以想关掉WebSecurity选项。
参考对象:CefSharp: browser.BrowserSettings.WebSecurity = CefState.Disabled;