Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/browsingdata/removecache/index.md
6552 views
---
title: browsingData.removeCache() slug: Mozilla/Add-ons/WebExtensions/API/browsingData/removeCache page-type: webextension-api-function tags: - API - Add-ons - Extensions - Method - Reference - WebExtensions - browsingData - removeCache browser-compat: webextensions.api.browsingData.removeCache
---

{{AddonSidebar()}}

Clears the browser's cache.

Note that although this function can take a {{WebExtAPIRef("browsingData.RemovalOptions")}} object, it will be ignored. The entire cache is always cleared when using this function.

This is an asynchronous function that returns a Promise.

Syntax

let removing = browser.browsingData.removeCache( removalOptions // RemovalOptions object )

Parameters

  • removalOptions {{optional_inline}}

    • : object. A {{WebExtAPIRef("browsingData.RemovalOptions")}} object. This parameter has no effect.

Return value

A Promise that will be fulfilled with no arguments when the removal has finished. If any error occurs, the promise will be rejected with an error message.

Examples

Clear the browser cache:

function onRemoved() { console.log("removed"); } function onError(error) { console.error(error); } browser.browsingData.removeCache({}).then(onRemoved, onError);

Browser compatibility

{{Compat}}

{{WebExtExamples}}

Note: This API is based on Chromium's chrome.browsingData API.