项目 / mdn/webextensions-examples

mdn/webextensions-examples

行业推荐
语言 JavaScript标签 webextensionswebextensions-apismdnbrowser数据更新 2026-11-25 06:49:28 · 仓库 2026-11-24

一段话介绍

Example Firefox add-ons created using the WebExtensions API

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
Example Firefox add-ons created using the WebExtensions API
4,475累计星
2,615Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

智能题库与自动阅卷

适配系统:考试系统、题库系统 · 得分 1.3

提供组卷、作答与自动评分链路,可嵌入考试系统降低教师批改成本。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
克隆仓库后,每个示例位于顶层文件夹并附 README 说明,可按安装步骤装入 Firefox 使用,多数示例兼容较早版本,少数需预发布版的示例会在 manifest.json 的 strict_min_version 中声明最低版本要求。
特点或设计要点
建议在最新版 Firefox 中试用,多数示例也可在较早版本中运行;少数依赖预发布版接口的示例,会在 `manifest.json` 的 `strict_min_version` 中声明最低版本。可在 Firefox 的 `about:debugging` 页临时加载示例的 `manifest.json`,或在示例目录中用 `web-ext run` 启动。这些示例使用 `browser` 命名空间和 Promise;若要在 Chrome 中运行,需配合 Mozilla 提供的 polyfill。源文写明默认不能在隐私浏览窗口中使用。许可证为 MPL-2.0。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-10-14 · 语言 JavaScript · 贡献者 —
javascript

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 4,726 字节。

# webextensions-examples [![Build Status](https://travis-ci.org/mdn/webextensions-examples.svg?branch=master)](https://travis-ci.org/mdn/webextensions-examples)

[https://github.com/mdn/webextensions-examples](https://github.com/mdn/webextensions-examples)

Maintained by Mozilla's [Add-ons team](https://wiki.mozilla.org/Add-ons).

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](https://developer.mozilla.org/Add-ons/WebExtensions/Examples).

The examples are made available under the
[Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/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](#installing-an-example). 

To find your way around a WebExtension's internal structure, have a look at the
[Anatomy of a WebExtension](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/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`](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/browser_specific_settings)
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](https://support.mozilla.org/en-US/kb/extensions-private-browsing#w_enabling-or-disabling-extensions-in-private-windows) 
for details.

To run an example extension:

1. Open Firefox and load the `about:debugging` page. Click 
   [Load Temporary Add-on](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox)
   and select the `manifest.json` file within the folder of an example extension.
2. Install the
   [web-ext](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_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](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext#Automatic_extension_reloading).

## Support for other browsers

These examples are tested in Firefox. They may work in other browsers, if the
[browser supports the APIs used](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs).
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](https://github.com/mozilla/webextension-polyfill).
See [the overview of WebExtension APIs](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API) 
for more information.

## Learn more

To learn more about developing WebExtensions, see the
[WebExtensions documentation on MDN](https://developer.mozilla.org/en-US/Add-ons/WebExtensions)
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](https://discourse.mozilla.org/c/add-ons).

If you cannot resolve the issue, [file a bug](https://github.com/mdn/webextensions-examples/issues/new).

## Contributing

We welcome contributions, whether they are new examples, new features, bug 
fixes, or translations of localizable strings. Please see the 
[CONTRIBUTING.md](https://github.com/mdn/webextensions-examples/blob/master/CONTRIBUTING.md)
file for more details.
↑