Compartir a través de


CoreWebView2EnvironmentOptions.EnableTrackingPrevention Property

Definition

The EnableTrackingPrevention property is used to enable/disable tracking prevention feature in WebView2. This property enable/disable tracking prevention for all the WebView2's created in the same environment. By default this feature is enabled to block potentially harmful trackers and trackers from sites that aren't visited before and set to @CoreWebView2TrackingPreventionLevel$.Balanced or whatever value was last changed/persisted on the profile.

public bool EnableTrackingPrevention { get; set; }
member this.EnableTrackingPrevention : bool with get, set
Public Property EnableTrackingPrevention As Boolean

Property Value

Remarks

You can set this property to false to disable the tracking prevention feature if the app only renders content in the WebView2 that is known to be safe. Disabling this feature when creating environment also improves runtime performance by skipping related code.

You shouldn't disable this property if WebView2 is being used as a "full browser" with arbitrary navigation and should protect end user privacy.

There is @CoreWebView2Profile.PreferredTrackingPreventionLevel property to control levels of tracking prevention of the WebView2's associated with a same profile. However, you can also disable tracking prevention later using @CoreWebView2Profile.PreferredTrackingPreventionLevel property and @CoreWebView2TrackingPreventionLevel$.None value but that doesn't improves runtime performance.

See @CoreWebView2Profile.PreferredTrackingPreventionLevel for more details.

Tracking prevention protects users from online tracking by restricting the ability of trackers to access browser-based storage as well as the network. See Tracking prevention.

Applies to