Get to know MDN better
Inserts JavaScript and CSS into websites. This API offers two approaches to inserting content:
Note: Chrome restricts this API to Manifest V3. Firefox and Safari support this API in Manifest V2 and V3.
This API requires the "scripting" permission and host permission for the target in the tab into which JavaScript or CSS is injected.
Alternatively, you can get permission temporarily in the active tab and only in response to an explicit user action, by asking for the "activeTab" permission. However, the "scripting" permission is still required.
Specifies the IDs of scripts to retrieve with scripting.getRegisteredContentScripts() or to unregister with scripting.unregisterContentScripts().
scripting.ExecutionWorldSpecifies the execution environment of a script injected with scripting.executeScript() or registered with scripting.registerContentScripts().
scripting.InjectionTargetDetails of an injection target.
scripting.RegisteredContentScriptDetails of a content script to be registered or that is registered.
Injects JavaScript code into a page.
scripting.getRegisteredContentScripts()Gets a list of registered content scripts.
scripting.insertCSS()Injects CSS into a page.
scripting.registerContentScripts()Registers a content script for future page loads.
scripting.removeCSS()Removes CSS which was previously injected into a page by a scripting.insertCSS() call.
scripting.updateContentScripts()Updates one or more content scripts already registered.
scripting.unregisterContentScripts()Unregisters one or more content scripts.
Enable JavaScript to view this browser compatibility table.
Note: This API is based on Chromium's chrome.scripting API.
This page was last modified on Jul 17, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.