The browsingData permission allows an extension to clear various types of browsing data.
What it does
- Enables an extension to programmatically remove items from a user's browser profile.
- Can clear data such as the cache, cookies, downloads, form data, history, local storage, and passwords.
- Data can be removed for a specific time period (e.g., the last hour, last 24 hours) or since the beginning of time.
- Can be configured to clear data only for specific origins (websites).
When to use it
This permission is primarily for privacy-focused extensions or tools that help manage a user's digital footprint.
Examples:
- A "one-click cleanup" extension that clears the cache and cookies.
- A testing tool for web developers that needs to reset the state of a website.
- An extension that automatically clears browsing history at the end of a session.
Manifest Declaration
This permission triggers a warning on installation.
{
"name": "My Privacy Cleaner",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"browsingData"
],
"background": {
"service_worker": "background.js"
}
}Security & Privacy
Why is it risky?
This permission is very powerful and can be destructive. It allows an extension to permanently delete your personal browsing data, which can include:
- Browsing history
- Cookies (which keep you logged into websites)
- Saved passwords
- Website cache and form data
While useful for privacy-cleaning tools, a malicious extension could use this to log you out of all your accounts, erase your history, or cause major inconvenience. Grant this permission only to highly trusted applications.
API Usage Example
This example clears the cache from the last 24 hours when the extension is installed.
// background.js
chrome.runtime.onInstalled.addListener(() => {
const oneDayAgo = (new Date()).getTime() - (24 * 60 * 60 * 1000);
chrome.browsingData.remove({
"since": oneDayAgo
}, {
"cache": true
}, () => {
if (chrome.runtime.lastError) {
console.error("Failed to clear cache:", chrome.runtime.lastError.message);
} else {
console.log("Cache from the last 24 hours has been cleared.");
}
});
});Extensions with the browsingData permission
Here are some popular browser extensions that use the "browsingData" permission. To explore more, try our Advanced search.