UserScripts.UserScriptOptions (Legacy)
Warning:
This is documentation for the legacy userScripts API. It's available in Firefox for Manifest V2. For functionality to work with user scripts in Manifest V3 see the new userScripts API.
The UserScriptOptions object represents the content scripts to register. It has similar syntax to the contentScript options supported by browser.contentScripts.register. The differences are:
- it does not support a CSS property (use
browser.contentScripts.registerto dynamically register/unregister stylesheets) - It does support an optional
scriptMetadataproperty (as a plain JSON object which contains some metadata properties associated to the registereduserScripts)
The UserScriptOptions object has the following properties:
allFramesOptional-
Same as
all_framesin thecontent_scriptskey. excludeGlobsOptional-
Same as
exclude_globsin thecontent_scriptskey. excludeMatchesOptional-
Same as
exclude_matchesin thecontent_scriptskey. includeGlobsOptional-
Same as
include_globsin thecontent_scriptskey. jsOptional-
An array of objects. Each object has either a property named
file, which is a URL starting at the extension's manifest.json and pointing to a JavaScript file to register, or a property namedcode, which is some JavaScript code to register. matchAboutBlankOptional-
Same as
match_about_blankin thecontent_scriptskey. matches-
Same as
matchesin thecontent_scriptskey. runAtOptional-
Same as
run_atin thecontent_scriptskey. scriptMetadataOptional-
A user script metadata value.
It has similar syntax to the contentScript options supported by browser.contentScripts.register.