ClearBrowsingData

Description

Clears browsing data in the WebBrowser control.

This function requires Microsoft Edge WebView2 Runtime 102.0.1245.22 or later to work.

Applies to

WebBrowser control

Syntax

controlname.ClearBrowsingData (BrowsingDataKinds datakinds)

Argument

Description

controlname

The name of the WebBrowser control from which you want to clear the browsing data

datakinds

A value of the BrowsingDataKinds enumerated type that specifies the type of browsing data to be cleared.

Values are:

  • BrowsingDataKindsAll! - Clears all types of browsing data.

  • BrowsingDataKindsFileSystems! - Clears website FileSystem data (e.g., HTML5 FileSystem API files).

  • BrowsingDataKindsIndexedDB! - Clears IndexedDB databases, which are used by modern web applications for structured data storage (larger than Local Storage).

  • BrowsingDataKindsLocalStorage! - Clears HTML5 Local Storage data, typically used by websites to store small amounts of persistent data on the client.

  • BrowsingDataKindsWebSql! - Clears Web SQL database data.

  • BrowsingDataKindsCacheStorage! - Clears Cache API and Service Worker cache data.

  • BrowsingDataKindsAllDomStorage! - Clears all DOM storage, including LocalStorage and SessionStorage.

  • BrowsingDataKindsCookies! - Clears all stored cookies, including session and persistent cookies.

  • BrowsingDataKindsAllSite! - Clears all site-related data, including cookies, LocalStorage, and IndexedDB.

  • BrowsingDataKindsDiskCache! - Clears the browser's disk cache (cached pages, images, etc.).

  • BrowsingDataKindsDownloadHistory! - Clears download history (does not delete downloaded files).

  • BrowsingDataKindsGeneralAutoFill! - Clears general form autofill data (form input history).

  • BrowsingDataKindsPasswordAutoSave! - Clears saved password information.

  • BrowsingDataKindsBrowsingHistory! - Clears the list of websites and pages visited.

  • BrowsingDataKindsSettings! - Clears site-specific settings or permissions (e.g., notifications, geolocation).

  • BrowsingDataKindsAllProfile! - Clears all profile-related data including history, cache, cookies, and storage.


Return value

Integer.

Returns 1 for success and -1 for failure.

Examples

This example clears all browsing data in the control:

Integer li_ret
li_ret = wb_1.ClearBrowsingData(BrowsingDataKindsAll!)

IF li_ret = 1 THEN
    MessageBox("Success", "All browsing data cleared.")
ELSE
    MessageBox("Error", "Failed to clear browsing data.")
END IF

See also

NavigateToString

OpenDefaultDownloadDialog