Partager via


CoreWebView2Environment.CreateCoreWebView2ControllerOptions Method

Definition

Overloads

CreateCoreWebView2ControllerOptions()

Creates a new CoreWebView2ControllerOptions object, which can be passed as a parameter in CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions) function for multiple profiles support.

CreateCoreWebView2ControllerOptions(String, Int32)

Create a new CoreWebView2ControllerOptions object, which can be passed as a parameter in CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions) function for multiple profiles support.

CreateCoreWebView2ControllerOptions()

public Microsoft.Web.WebView2.Core.CoreWebView2ControllerOptions CreateCoreWebView2ControllerOptions ();
member this.CreateCoreWebView2ControllerOptions : unit -> Microsoft.Web.WebView2.Core.CoreWebView2ControllerOptions
Public Function CreateCoreWebView2ControllerOptions () As CoreWebView2ControllerOptions

Returns

A CoreWebView2ControllerOptions that can be passed when calling CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions).

Remarks

The options is a settable property while the default for profile name is an empty string and the default value for IsInPrivateModeEnabled is false. The profile will be created on disk or opened when calling CreateCoreWebView2ControllerWithOptions no matter InPrivate mode is enabled or not, and it will be released in memory when the corresponding CoreWebView2Controller is closed but still remain on disk. As WebView2 is built on top of Edge browser, it follows Edge's behavior pattern. To create an InPrivate WebView, we get an off-the-record profile (an InPrivate profile) from a regular profile, then create the WebView with the off-the-record profile. Also the profile name can be reused.

Applies to

CreateCoreWebView2ControllerOptions(String, Int32)

public Microsoft.Web.WebView2.Core.CoreWebView2ControllerOptions CreateCoreWebView2ControllerOptions (string ProfileName, int IsInPrivateModeEnabled);
member this.CreateCoreWebView2ControllerOptions : string * int -> Microsoft.Web.WebView2.Core.CoreWebView2ControllerOptions
Public Function CreateCoreWebView2ControllerOptions (ProfileName As String, IsInPrivateModeEnabled As Integer) As CoreWebView2ControllerOptions

Parameters

ProfileName
String

The name of the profile.

IsInPrivateModeEnabled
Int32

InPrivate mode is enabled or not.

Returns

A CoreWebView2ControllerOptions that can be passed when calling CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions).

Remarks

The options is a settable property while the default for profile name is empty string and the default value for IsInPrivateModeEnabled is false. The profile will be created on disk or opened when calling 'CreateCoreWebView2ControllerWithOptions'no matter InPrivate mode is enabled or not, and it will be released in memory when the correspoding controller is closed but still remain on disk. As WebView2 is built on top of Edge browser, it follows Edge's behavior pattern. To create an InPrivate WebView, we gets an off-the record profile (an InPrivate profile) from a regular profile, then create the WebView with the off-the-record profile. Also the profile name can be reused.

Applies to