Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Extension Browsing Data API: Removal, Origins, and Data Types

How the browsingData extension API clears profile data by time, origin, and type—and what limits and deprecations apply.

This page summarises Chrome extension platform documentation for removing browsing data from a user’s local profile with browser.browsingData (and the equivalent chrome.browsingData namespace in Manifest V2). The API is the usual choice when an extension should clear cookies, cache, history, or site storage in bulk—not when you only need one cookie, one history URL, or extension-local keys (those use separate APIs, covered briefly below).

browsingData API: what it clears from the profile

Section titled “browsingData API: what it clears from the profile”

The browsingData API removes data stored in the user’s browser profile—similar in spirit to the built-in “Clear browsing data” UI, but driven by your extension code.

Use the chrome.browsingData API to remove browsing data from a user’s local profile.

— Google, chrome.browsingData

You must declare the browsingData permission in the extension manifest. Without it, none of the removal methods run.

The main entry point is browser.browsingData.remove(options, dataToRemove), which clears the types you set in dataToRemove according to RemovalOptions. It returns a Promise<void>; the Manifest V2 reference also documents an optional callback on chrome.browsingData.remove.

Clears various types of browsing data stored in a user’s profile.

— Google, browser.browsingData.remove()

Manifest permission and when to use remove() vs granular methods

Section titled “Manifest permission and when to use remove() vs granular methods”

After adding "browsingData" to permissions, choose between one combined call and type-specific helpers.

The browser.browsingData.remove() method lets you remove various types of browsing data with a single call, and will be much faster than calling multiple more specific methods. If, however, you only want to clear one specific type of browsing data (cookies, for example), the more granular methods offer a readable alternative to a call filled with JSON.

— Google, browser.browsingData

Granular methods include removeCookies, removeCache, removeHistory, removeLocalStorage, removeIndexedDB, removeCacheStorage, removeServiceWorkers, and others listed on the same reference pages (MV3, MV2). Each takes RemovalOptions only.

The most common pattern is “delete everything since date X”. Pass since as milliseconds since the Unix epoch (for example from Date.prototype.getTime()).

The simplest use-case for this API is a time-based mechanism for clearing a user’s browsing data. Your code should provide a timestamp which indicates the historical date after which the user’s browsing data should be removed.

— Google, browser.browsingData

If since is omitted, it defaults to 0, which removes all accumulated data for the selected types—not “since yesterday” unless you set that timestamp explicitly.

Example shape (namespace may be chrome or browser depending on your extension setup):

const oneWeekAgo = Date.now() - 1000 * 60 * 60 * 24 * 7;
await chrome.browsingData.remove(
{ since: oneWeekAgo },
{
cache: true,
cacheStorage: true,
cookies: true,
history: true,
indexedDB: true,
localStorage: true,
serviceWorkers: true,
}
);

Clearing can take a long time; do not assume synchronous completion.

Important: Removing browsing data involves a good deal of heavy lifting in the background, and can take tens of seconds to complete, depending on a user’s profile. You should use either the returned promise or the callback to keep your users up to date on the removal’s status.

— Google, browser.browsingData

RemovalOptions: origins, excludeOrigins, and originTypes

Section titled “RemovalOptions: origins, excludeOrigins, and originTypes”

RemovalOptions controls which profile data is affected beyond the data-type flags.

Option Role Main constraint
since Only data on or after this time Applies broadly to selected types
origins Delete only listed origins Cookies, cache, storage types only; not with excludeOrigins
excludeOrigins Skip listed origins Same scope as origins; cookie exclusion is registrable-domain wide
originTypes Limit to unprotected / protected / extension origins Defaults to unprotected web only if omitted

origins and excludeOrigins for one site or keep-list

Section titled “origins and excludeOrigins for one site or keep-list”

To remove data for a specific origin or to exclude a set of origins from deletion, you can use the RemovalOptions.origins and RemovalOptions.excludeOrigins parameters. They can only be applied to cookies, cache, and storage (CacheStorage, FileSystems, IndexedDB, LocalStorage, ServiceWorkers, and WebSQL).

— Google, browser.browsingData

Cookie deletion is broader than a single URL:

Important: As cookies are scoped more broadly than other types of storage, deleting cookies for an origin will delete all cookies of the registrable domain. For example, deleting data for https://www.example.com will delete cookies with a domain of .example.com as well.

— Google, browser.browsingData

originTypes: unprotectedWeb, protectedWeb, and extension

Section titled “originTypes: unprotectedWeb, protectedWeb, and extension”

If you don’t specify an originTypes, the API defaults to removing data from unprotected web origins.

— Google, browser.browsingData

originTypes flag Meaning
unprotectedWeb Normal websites users visit without installing them as apps
protectedWeb Hosted apps installed from the store (e.g. game save data)
extension chrome-extension: origins

Warning: Be careful with the protectedWeb and extension origin types. These are destructive operations that may surprise your users if they’re not well-informed about what to expect when your extension removes data on their behalf.

— Google, browser.browsingData

DataTypeSet: supported types and ignored deprecations

Section titled “DataTypeSet: supported types and ignored deprecations”

In dataToRemove, each property is optional; omitted types are treated as false.

A set of data types. Missing data types are interpreted as false.

— Google, browser.browsingData

Property Still effective Notes
cache, cookies, downloads, fileSystems, formData, history Yes Core profile / site data
cacheStorage, serviceWorkers Yes Site storage and workers
indexedDB, localStorage Yes Per-origin storage
appcache, webSQL No (ignored) Support removed; related remove* calls have no effect
passwords No (ignored) Password deletion via extensions removed
pluginData, serverBoundCertificates No (ignored) Legacy features removed

Setting passwords: true or calling removePasswords() does not clear saved passwords anymore. Plan on users clearing passwords through browser settings, not through this API.

removeDownloads() clears the download list, not the files on disk:

Clears the browser’s list of downloaded files (not the downloaded files themselves).

— Google, browser.browsingData.removeDownloads()

Sync account cookies: remove() vs removeCookies()

Section titled “Sync account cookies: remove() vs removeCookies()”

If the user syncs data, bulk removal may recreate a Sync cookie so sync can continue and server-side deletion can proceed; targeted cookie removal can pause Sync.

If the user is syncing their data, browser.browsingData.remove() may automatically rebuild the cookie for the Sync account after clearing it. This is to ensure that Sync can continue working, so that the data can be eventually deleted on the server. However the more specific browser.browsingData.removeCookies() can be used to clear the cookie for the Sync account, and Sync will be paused in this case.

— Google, browser.browsingData

Choose remove() when you want a broad wipe with Sync-friendly behavior; use removeCookies() when you intentionally need to clear the Sync account cookie and accept paused Sync.

settings(): align with Clear browsing data UI

Section titled “settings(): align with Clear browsing data UI”

browser.browsingData.settings() reports which data types are selected in the user’s “Clear browsing data” settings. The MV2 reference also splits permitted vs selected types via dataRemovalPermitted and dataToRemove in the callback result.

Reports which types of data are currently selected in the ‘Clear browsing data’ settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.

— Google, browser.browsingData.settings()

Use this when you want extension behavior to mirror what the user already chose in settings, or to respect enterprise policy flags returned as non-permitted types.

Section titled “Related removal APIs when browsingData is not the right fit”

Other cluster documents describe narrower remove operations. They are not substitutes for full profile clearing unless that is all you need.

Goal API Difference from browsingData
Delete one cookie by name browser.cookies.remove Single cookie; needs host/cookie details, not bulk since
Delete specific history URLs or a date range browser.history.deleteUrl / deleteRange History only; range rule: a page stays until all its visits fall in the range
Clear data inside an embedded webview partition chrome.webviewTag.clearData Partition-scoped; cache clears entire cache, not limited by since
Remove extension storage keys browser.storage.StorageArea.remove Your extension’s own storage, not the user’s browsing profile

For history ranges:

Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.

— Google, browser.history.deleteRange()

For webviews:

Note: when removing data, this clears the entire cache; it is not limited to the range you specify.

— Google, ClearDataTypeSet (webviewTag)

Menu items, permissions, reading list entries, and unrelated store APIs (contextMenus.remove, permissions.remove, etc.) remove extension UI or capability—not browsing profile data—and are outside the scope of browsingData.

  • Assuming since defaults to a recent window instead of all time when omitted.
  • Using origins with history or downloads in the same remove() call without checking that those types ignore origin scoping.
  • Clearing protectedWeb or extension without explaining irreversible app or extension data loss.
  • Expecting passwords: true or deprecated types to do anything—they are ignored.
  • Blocking the UI before the remove() promise resolves despite multi-second backend work.
  1. Load a test extension that calls browsingData.remove with a narrow since and a small origins list; confirm only the intended site loses cookies or storage in DevTools Application (not production user profiles without consent).

  2. Compare your extension’s defaults with browser.browsingData.settings() and the browser’s Clear browsing data dialog so type selection matches user expectations.

  3. After a cookie wipe with Sync enabled, verify whether Sync stays active (remove) or pauses (removeCookies), matching the behavior described in browser.browsingData.

  4. Confirm deprecated flags (passwords, webSQL, appcache) do not change profile state when set to true.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.