MCPcopy Index your code
hub / github.com/mdn/webextensions-examples

github.com/mdn/webextensions-examples @main

repository ↗ · DeepWiki ↗ · + Follow
295 symbols 582 edges 125 files 58 documented · 20% updated 2d ago★ 4,45817 open issues
README

webextensions-examples Build Status

https://github.com/mdn/webextensions-examples

Maintained by Mozilla's Add-ons team.

WebExtensions are a way to write browser extensions: that is, programs installed inside a web browser that modify the behavior of the browser or web pages loaded by the browser. WebExtensions are built on a set of cross-browser APIs, so WebExtensions written for Google Chrome, Opera, or Edge will, in most cases, run in Firefox too.

The "webextensions-examples" repository is a collection of simple, complete, and installable WebExtensions. The examples show how to use the WebExtensions APIs, and you can use them as a starting point for your WebExtensions.

For an index of all the examples, see the "Example extensions" page on MDN.

The examples are made available under the Mozilla Public License 2.0.

How to use "webextensions-examples"

To use the repository, first clone it.

Each example is in a top-level folder and includes a short README explaining what it does. To see how an example works, install it in Firefox by following the installation instructions.

To find your way around a WebExtension's internal structure, have a look at the Anatomy of a WebExtension page on MDN.

To use these examples in Firefox, use the most recent release of Firefox. However, most examples work with earlier releases.

A few examples rely on APIs that are only available in pre-release versions of Firefox. Where this is the case, the example declares the minimum version that it needs in the strict_min_version attribute of the browser_specific_settings key in the extension's manifest.json file.

Installing an example

Some examples work only on specific domains or pages. Details of any restrictions are provided in each example's README file. None of the examples work in private browsing windows by default, see Extensions in Private Browsing for details.

To run an example extension:

  1. Open Firefox and load the about:debugging page. Click Load Temporary Add-on and select the manifest.json file within the folder of an example extension.
  2. Install the web-ext tool. At the command line, open the example extension's folder and type web-ext run. This launches Firefox and installs the extension automatically. This tool provides some additional development features, such as automatic reloading.

Support for other browsers

These examples are tested in Firefox. They may work in other browsers, if the browser supports the APIs used. Note that these examples all use the browser namespace and promises to work with asynchronous functions. This means the examples won't work in Chrome unless you use the polyfill provided by Mozilla. See the overview of WebExtension APIs for more information.

Learn more

To learn more about developing WebExtensions, see the WebExtensions documentation on MDN for getting started guides, tutorials, and full API reference docs.

Problems?

If you encounter an issue, post a query on the add-ons discourse forum.

If you cannot resolve the issue, file a bug.

Contributing

We welcome contributions, whether they are new examples, new features, bug fixes, or translations of localizable strings. Please see the CONTRIBUTING.md file for more details.

Core symbols most depended-on inside this repo

remove
called by 24
store-collected-images/webextension-plain/deps/idb-file-storage.js
setState
called by 16
store-collected-images/webextension-plain/popup.js
waitForDOMRequest
called by 16
store-collected-images/webextension-plain/deps/idb-file-storage.js
callOnActiveTab
called by 10
tabs-tabs-tabs/tabs.js
initializedDB
called by 9
store-collected-images/webextension-plain/deps/idb-file-storage.js
ensureLocked
called by 7
store-collected-images/webextension-plain/deps/idb-file-storage.js
getObjectStoreTransaction
called by 7
store-collected-images/webextension-plain/deps/idb-file-storage.js
get
called by 6
store-collected-images/webextension-plain/deps/idb-file-storage.js

Shape

Function 222
Method 57
Class 16

Languages

TypeScript99%
Python1%

Modules by API surface

store-collected-images/webextension-plain/deps/idb-file-storage.js41 symbols
mocha-client-tests/addon/scripts/browser-polyfill.min.js20 symbols
store-collected-images/webextension-plain/navigate-collection.js10 symbols
store-collected-images/webextension-with-webpack/src/navigate-collection.js8 symbols
store-collected-images/webextension-plain/popup.js8 symbols
userScripts-mv3/userscript_manager_logic.mjs7 symbols
userScripts-mv3/options.mjs7 symbols
quicknote/popup/quicknote.js7 symbols
imagify/sidebar/choose_file.js7 symbols
forget-it/background.js6 symbols
beastify/popup/choose_beast.js6 symbols
userScripts-mv3/background.js5 symbols

Dependencies from manifests, versioned

@babel/eslint-parser7.22.11 · 1×
babel-core6.24.1 · 1×
babel-loader7.0.0 · 1×
babel-plugin-transform-class-properties6.24.1 · 1×
babel-plugin-transform-es2015-modules-commonjs6.24.1 · 1×
babel-plugin-transform-object-rest-spread6.23.0 · 1×
babel-preset-es20176.24.1 · 1×
babel-preset-react6.24.1 · 1×
chai3.5.0 · 1×
eslint8.48.0 · 1×
expect.js0.3.1 · 1×
idb-file-storage0.1.0 · 1×

For agents

$ claude mcp add webextensions-examples \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact