pub struct EnvironmentOptions { /* private fields */ }Expand description
Configures the WebView2 Environment, including the user data folder, the
browser executable folder, additional browser command-line arguments, and the
UI language. Build one with the fluent setters and pass it to
Environment::with_options.
use windows_webview::EnvironmentOptions;
let options = EnvironmentOptions::new()
.user_data_folder(r"C:\MyApp\WebView2")
.additional_browser_arguments("--disable-features=msSmartScreenProtection")
.language("en-US");Implementations§
Source§impl EnvironmentOptions
impl EnvironmentOptions
Sourcepub fn browser_executable_folder(self, value: impl Into<String>) -> Self
pub fn browser_executable_folder(self, value: impl Into<String>) -> Self
Sets the folder containing the WebView2 browser (Edge) binaries to use instead of the installed runtime.
Sourcepub fn user_data_folder(self, value: impl Into<String>) -> Self
pub fn user_data_folder(self, value: impl Into<String>) -> Self
Sets the folder where WebView2 stores its user data (cache, cookies, …).
Sourcepub fn additional_browser_arguments(self, value: impl Into<String>) -> Self
pub fn additional_browser_arguments(self, value: impl Into<String>) -> Self
Sets additional command-line arguments passed to the browser process.
Sourcepub fn language(self, value: impl Into<String>) -> Self
pub fn language(self, value: impl Into<String>) -> Self
Sets the default display language (for example "en-US").
Sourcepub fn target_compatible_browser_version(self, value: impl Into<String>) -> Self
pub fn target_compatible_browser_version(self, value: impl Into<String>) -> Self
Sets the minimum compatible browser version the environment requires.
When unset, the environment uses the WebView2 GA baseline
(86.0.616.0), which every supported runtime satisfies.
Sourcepub fn allow_single_sign_on_using_os_primary_account(self, value: bool) -> Self
pub fn allow_single_sign_on_using_os_primary_account(self, value: bool) -> Self
Enables single sign-on using the operating system’s primary account.
Sourcepub fn are_browser_extensions_enabled(self, value: bool) -> Self
pub fn are_browser_extensions_enabled(self, value: bool) -> Self
Enables loading and running browser extensions in the environment.
Sourcepub fn scrollbar_style(self, value: ScrollBarStyle) -> Self
pub fn scrollbar_style(self, value: ScrollBarStyle) -> Self
Sets the scrollbar style pages render with.
Trait Implementations§
Source§impl Clone for EnvironmentOptions
impl Clone for EnvironmentOptions
Source§fn clone(&self) -> EnvironmentOptions
fn clone(&self) -> EnvironmentOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more