This object contains details of a script to be registered or that is registered.
scripting.RegisteredContentScript
Type
Values of this type are objects. They contain these properties:
-
allFramesOptional -
boolean. If specifiedtrue, the script is inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it does not inject into child frames if the URL requirements are not met. Defaults tofalse, meaning that only the top frame is matched. -
cssOptional -
arrayofstring. The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array. -
excludeMatchesOptional -
arrayofstring. Array of pages that this content script is excluded from but would otherwise be injected into. id-
string. The ID of the content script, specified in the API call. -
jsOptional -
arrayofstring. Array of path to JavaScript files in the extension package to inject into matching pages. Scripts are injected in the order they appear in this array. -
matchesOptional -
arrayofstring. Array of the pages this content script is injected into. Must be specified forscripting.registerContentScripts(). -
persistAcrossSessionsOptional -
boolean. Specifies if this content script persists across browser restarts and updates and extension restarts. Defaults totrue. -
runAtOptional -
extensionTypes.RunAt. Specifies when JavaScript files are injected into the web page. The default value isdocument_idle. In Firefox,runAtalso affects the point where the CSS is inserted. In Chrome,runAtdoes not affect the CSS insertion point. -
worldOptional -
scripting.ExecutionWorld. The execution environment for a script to execute in. The default value isISOLATED.
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
RegisteredContentScript |
88 | 88 | 102 | ? | 74 | 16.4Available for use in Manifest V2 or later. |
? | ? | 102 | ? | 16.4Available for use in Manifest V2 or later. |
? |
persistAcrossSessions |
88 | 88 | 102["Since Firefox 105, this option is optional and accepts any boolean value.", "Prior to Firefox 105, this option was required and only accepted thefalse value."] |
? | 74 | 16.4Available for use in Manifest V2 or later. |
? | ? | 102["Since Firefox 105, this option is optional and accepts any boolean value.", "Prior to Firefox 105, this option was required and only accepted thefalse value."] |
? | 16.4Available for use in Manifest V2 or later. |
? |
world |
102 | 102 | No | ? | 88 | No | ? | ? | No | ? | No | ? |
Note: This API is based on Chromium's chrome.scripting API.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/RegisteredContentScript