userScripts.RegisteredUserScript

An object representing registered user scripts. Returned by userScripts.getScripts() and used as input to userScripts.register() and userScripts.update().

Type

Values of this type are an object containing these properties:

allFrames Optional

boolean. If allFrames is true, the script is injected into all of a page's frames. By default, it's false and the script is only injected into the top frame.

id

string. The ID of a user script. This property must not start with a '_', which is reserved as a prefix for generated script IDs.

js Optional for userScripts.update() calls, required for userScripts.register()

array of userScripts.ScriptSource. The scripts to inject into matching pages.

matches Optional

array of string. Match patterns for the pages to run the script in. matches or includeGlobs must be specified in userScripts.register() calls.

excludeMatches Optional

array of string. Match patterns for pages that the script must not be run in.

includeGlobs Optional

string. Glob patterns for the pages to run the script in. matches or includeGlobs must be specified in userScripts.register() calls.

excludeGlobs Optional

string. Glob patterns for pages that the script must not be run in.

runAt Optional

extensionTypes.RunAt. The earliest the script is injected into a tab. Defaults to "document_idle".

world Optional

userScripts.ExecutionWorld. The execution environment to use to run the scripts. Defaults to "USER_SCRIPT".

worldId Optional

string. ID of a user script world the script executes in. Only valid if world is USER_SCRIPT or omitted. If worldId is omitted, the script is executed in the default USER_SCRIPT world (""). Values with leading underscores (_) are reserved. The maximum length is 256 characters. A world can be used by several scripts as their execution environment. To configure the behavior of a world, pass its worldId to userScripts.configureWorld before the first script executes in that world.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
RegisteredUserScript
Chrome – Full support
Chrome 120 (Release date: 2023-12-05)
footnote Full support
Edge – Full support
Edge 120 (Release date: 2023-12-07)
footnote Full support
Firefox – Full support
Firefox 136 (Release date: 2025-03-04)
footnote Full support
Opera – Full support
Opera 106 (Release date: 2023-12-19)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 138 (Release date: 2025-04-29)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
worldId
Chrome – Full support
Chrome 133 (Release date: 2025-02-04)
footnote Full support
Edge – Full support
Edge 133 (Release date: 2025-02-06)
footnote Full support
Firefox – Full support
Firefox 136 (Release date: 2025-03-04)
footnote Full support
Opera – Full support
Opera 118 (Release date: 2025-04-15)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 138 (Release date: 2025-04-29)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support