Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/scripting/unregistercontentscripts/index.md
6552 views
---
title: scripting.unregisterContentScripts() slug: Mozilla/Add-ons/WebExtensions/API/scripting/unregisterContentScripts page-type: webextension-api-function tags: - API - Add-ons - Extensions - Method - Reference - WebExtensions - unregisterContentScripts - tabs browser-compat: webextensions.api.scripting.unregisterContentScripts
---

{{AddonSidebar()}}

Unregisters one or more content scripts.

Note: This method is available in Manifest V3 or higher in Chrome and Firefox 101. In Firefox 102+, this method is also available in Manifest V2.

To use this API you must have the "scripting" permission and permission for the page's URL, either explicitly as a host permission or using the activeTab permission.

This is an asynchronous function that returns a Promise.

Syntax

await browser.scripting.unregisterContentScripts( scripts // object )

Parameters

  • scripts {{optional_inline}}

    • : {{WebExtAPIRef("scripting.ContentScriptFilter")}}. A filter to identify the dynamic content scripts to unregistered. If not specified, all dynamic content scripts are unregistered.

Return value

A Promise that fulfills with no arguments when all the scripts are unregistered. If any error occurs, the promise is rejected.

Examples

This example unregisters a registered content script with ID a-script:

try { await browser.scripting.unregisterContentScripts({ ids: ["a-script"], }); } catch (err) { console.error(`failed to unregister content scripts: ${err}`); }

{{WebExtExamples}}

Browser compatibility

{{Compat}}

Note: This API is based on Chromium's chrome.scripting API.