RegisteredUserScript.unregister() (Legacy)
The unregister() method of the RegisteredUserScript object unregisters the user scripts represented by the object, user scripts that were registered using userScripts.register().
> [!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 `unregister()` method of the RegisteredUserScript object unregisters the user scripts represented by the object, user scripts that were registered using 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
```js-nolint
const registeredUserScript = await browser.userScripts.register(
userScriptOptions // object
);
// …
await registeredUserScript.unregister()
```
### Parameters
None.
### Return value
A Promise that is resolved once the user scripts are unregistered. The promise does not return a value.
## Browser compatibility
## See also
- userScripts.register()
- RegisteredUserScript
Cite this
"RegisteredUserScript.unregister() (Legacy)". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/userScripts_legacy/RegisteredUserScript/unregister JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy