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.
Set the PreferredTrackingPreventionLevel property.
Clear browsing data based on a data type. This method takes two parameters, the first being a mask of one or more COREWEBVIEW2_BROWSING_DATA_KINDS. OR operation(s) can be applied to multiple COREWEBVIEW2_BROWSING_DATA_KINDS to create a mask representing those data types. The browsing data kinds that are supported are listed below. These data kinds follow a hierarchical structure in which nested bullet points are included in their parent bullet point's data kind. Ex: All DOM storage is encompassed in all site data which is encompassed in all profile data. * All Profile * All Site Data * All DOM Storage: File Systems, Indexed DB, Local Storage, Web SQL, Cache Storage * Cookies * Disk Cache * Download History * General Autofill * Password Autosave * Browsing History * Settings The completed handler will be invoked when the browsing data has been cleared and will indicate if the specified data was properly cleared. In the case in which the operation is interrupted and the corresponding data is not fully cleared the handler will return E_ABORT and otherwise will return S_OK. Because this is an asynchronous operation, code that is dependent on the cleared data must be placed in the callback of this operation. If the WebView object is closed before the clear browsing data operation has completed, the handler will be released, but not invoked. In this case the clear browsing data operation may or may not be completed. ClearBrowsingData clears the dataKinds regardless of timestamp.
ClearBrowsingDataInTimeRange behaves like ClearBrowsingData except that it takes in two additional parameters for the start and end time for which it should clear the data between. The startTime and endTime parameters correspond to the number of seconds since the UNIX epoch. startTime is inclusive while endTime is exclusive, therefore the data will be cleared between [startTime, endTime).
ClearBrowsingDataAll behaves like ClearBrowsingData except that it clears the entirety of the data associated with the profile it is called on. It clears the data regardless of timestamp.