unregister

The unregister() method of RegisteredUserScript interface unregisters the User Script represented by that interface instance and previously registered via userScripts.register().

Note: User Scripts are automatically unregistered when the related extension page (from which the user scripts were registered) is unloaded, so you should register a user script from an extension page that persists at least as long as you want the user scripts to stay registered.

Syntax

const registeredUserScript = await browser.userScripts.register(
  userScriptOptions       // object
);
…
await registeredUserScript.unregister()

Parameters

None.

Return value

A Promise that will be resolved once the User Script is unregistered. The promise does not return any value.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
unregisterChrome No support NoEdge No support NoFirefox Full support 68
Full support 68
Full support 66
Disabled
Disabled From version 66: this feature is behind the extensions.webextensions.userScripts.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera No support NoFirefox Android Full support 68

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

See also