Compartilhar via


CoreWebView2Profile.PreferredTrackingPreventionLevel Property

Definition

The PreferredTrackingPreventionLevel property allows you to control levels of tracking prevention for WebView2 which are associated with a profile. This level would apply to the context of the profile. That is, all WebView2s sharing the same profile will be affected and also the value is persisted in the user data folder.

See CoreWebView2TrackingPreventionLevel for descriptions of levels.

public Microsoft.Web.WebView2.Core.CoreWebView2TrackingPreventionLevel PreferredTrackingPreventionLevel { get; set; }
member this.PreferredTrackingPreventionLevel : Microsoft.Web.WebView2.Core.CoreWebView2TrackingPreventionLevel with get, set
Public Property PreferredTrackingPreventionLevel As CoreWebView2TrackingPreventionLevel

Property Value

Remarks

If tracking prevention feature is enabled when creating the WebView2 environment, you can also disable tracking prevention later using this property and @CoreWebView2TrackingPreventionLevel$.None value but that doesn't improves runtime performance.

There is @CoreWebView2EnvironmentOptions.EnableTrackingPrevention property to enable/disable tracking prevention feature for all the WebView2's created in the same environment. If enabled, PreferredTrackingPreventionLevel is set to @CoreWebView2TrackingPreventionLevel$.Balanced by default for all the WebView2's and profiles created in the same environment or is set to the level whatever value was last changed/persisted to the profile. If disabled PreferredTrackingPreventionLevel is not respected by WebView2. If PreferredTrackingPreventionLevel is set when the feature is disabled, the property value get changed and persisted but it will takes effect only if @CoreWebView2EnvironmentOptions.EnableTrackingPrevention is true.

See @CoreWebView2EnvironmentOptions.EnableTrackingPrevention for more details.

Applies to