browsingData.settings()

Browsers have a built-in "Clear History" feature, which enables the user to clear various types of browsing data. This has a UI that enables the user to select what type of data to remove (e.g., history, downloads, …) and how far back in time to remove data.

This function returns the current value of these settings.

Note that not all data types will always be removable through the UI, and some UI options may map to more than one data type.

This is an asynchronous function that returns a Promise.

Syntax

js
let getSettings = browser.browsingData.settings()

Parameters

None.

Return value

A Promise that will be fulfilled with an object containing the settings information. This object has three properties:

options

browsingData.RemovalOptions. A RemovalOptions object describing the removal options currently selected.

dataToRemove

browsingData.DataTypeSet. This will contain a property for every data type that can be toggled in the browser's UI. Each property will have a value of true if that type is selected for removal and false otherwise.

dataRemovalPermitted

browsingData.DataTypeSet. This will contain a property for every data type that can be toggled in the browser's UI. Each will have a value of true if the administrator of the device has allowed the user to remove that type, and false otherwise.

If any error occurs, the promise will be rejected with an error message.

Examples

Log current settings:

js
function onGotSettings(settings) {
  console.log(settings.options);
  console.log(settings.dataToRemove);
  console.log(settings.dataRemovalPermitted);
}

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

browser.browsingData.settings().then(onGotSettings, onError);

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
settings
Chrome – Full support
Chrome 26 (Release date: 2013-03-26)
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 56 – 68 (Release date: 2017-09-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

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.