browsingData.removeCache()

Clears the browser's cache.

Note that this function requires a browsingData.RemovalOptions object, but all options are ignored. The entire cache is always cleared when using this function.

This is an asynchronous function that returns a Promise.

Syntax

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

Parameters

removalOptions

object. A browsingData.RemovalOptions object. This parameter must be set but 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:

js
function onRemoved() {
  console.log("removed");
}

function onError(error) {
  console.error(error);
}

browser.browsingData.removeCache({}).then(onRemoved, onError);

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
removeCache
Chrome – Full support
Chrome 19 (Release date: 2012-05-15)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 53 (Release date: 2017-04-19)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android 57 – 68 (Release date: 2017-11-28)
footnote Removed in 79 and later
Firefox for Android – Full support
Firefox for Android 85 (Release date: 2021-01-26)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
removalOptions
Chrome – Full support
Chrome 19 (Release date: 2012-05-15)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 53 (Release date: 2017-04-19)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android 57 – 68 (Release date: 2017-11-28)
footnote Removed in 79 and later
Firefox for Android – Full support
Firefox for Android 85 (Release date: 2021-01-26)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
removalOptions.since
Chrome – Full support
Chrome 19 (Release date: 2012-05-15)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Has more compatibility info.

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