userScripts.configureWorld()

Configures USER_SCRIPT execution environments for the extension.

Changes to world configurations only apply to new instances of the world: A configuration won't apply to a world initialized by the execution of a user script in a document until the document is reloaded. However, the browser may revoke certain privileges when a configuration is updated. For example, message calls from a USER_SCRIPT world may fail if the extension sets messaging to false.

World configurations persist until the extension is updated or the configuration is reset by userScripts.resetWorldConfiguration().

Syntax

js
let configuredWorld = browser.userScripts.configureWorld(
  properties       // object
);

Parameters

properties

userScripts.WorldProperties. Details of the configuration for a USER_SCRIPT world.

When worldId is omitted or the string is empty, the update is applied to the default world and all worlds without an explicit configuration. When worldId is specified only that world is configured.

When updating the default world and worlds without an explicit configuration, when properties are omitted the userScripts.WorldProperties defaults are used.

Return value

A Promise fulfilled with no arguments if the request is successful. If the request fails, the promise is rejected with an error message.

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
configureWorld
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

Legend

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

Full support
Full support
No support
No support