The contentSettings permission allows an extension to modify settings that control whether websites can use features such as cookies, JavaScript, and plugins.
What it does
- Provides an API (
chrome.contentSettings) to read and modify global or per-site browser settings. - Can control a wide range of content types, including:
cookiesjavascriptimagespopupsnotificationslocation(geolocation)
- Settings can be allowed, blocked, or set to "ask the user" for specific websites.
When to use it
This is for extensions that provide fine-grained control over browser features, often for privacy, security, or productivity purposes.
Examples:
- A "NoScript" style extension that blocks JavaScript by default and allows users to whitelist specific sites.
- A privacy tool that blocks third-party cookies on all websites.
- A parental control extension that blocks images on certain domains.
- A "focus mode" extension that disables notifications from all sites except a few whitelisted ones.
Manifest Declaration
This permission triggers a warning on installation.
{
"name": "My Content Settings Manager",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"contentSettings"
]
}Security & Privacy
Why is it risky?
This permission gives an extension control over fundamental browser settings for every website. It can decide whether sites are allowed to use features like:
- JavaScript (which makes sites interactive)
- Cookies (which store login info)
- Pop-ups, camera, microphone, and location access
A malicious extension could use this to disable a website's security features, or to allow a dangerous website to access your camera or location without you knowing. This gives the extension a huge amount of control over your browsing experience and security.
API Usage Example
This example blocks JavaScript from running on annoying-site.com.
// background.js
chrome.runtime.onInstalled.addListener(() => {
const pattern = 'https://*.annoying-site.com/*';
chrome.contentSettings['javascript'].set({
primaryPattern: pattern,
setting: 'block'
}, () => {
if (chrome.runtime.lastError) {
console.error('Failed to set content setting:', chrome.runtime.lastError.message);
} else {
console.log('JavaScript has been blocked for annoying-site.com.');
}
});
});Extensions with the contentSettings permission
Here are some popular browser extensions that use the "contentSettings" permission. To explore more, try our Advanced search.