webextensions-examples

Example Firefox add-ons created using the WebExtensions API

Github星跟蹤圖

webextensions-examples Build Status

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

Maintained by the MDN team at Mozilla.

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

The "webextensions-examples" repository is a collection of simple but complete
and installable WebExtensions. You can use the examples to see how to use the
WebExtensions APIs, and as a starting point for your own 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 its own top-level directory. Install an example in your
favourite web browser (installation instructions are below),
and see how it works. Each example has its own short README explaining what
it does.

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, you should use the most recent release
of Firefox. Some examples work with earlier releases.

A few examples rely on APIs that are currently only available in pre-release
versions of Firefox. Where this is the case, the example should declare
the minimum version that it needs in the strict_min_version part of the
applications key
in its manifest.json file.

Installing an example

There are a couple ways to try out the example extensions in this repository.

  1. Open Firefox and load about:debugging in the URL bar. Click the
    Load Temporary Add-on
    button and select the manifest.json file within the
    directory of an example extension you'd like to install.
    Here is a video
    that demonstrates how to do this.
  2. Install the
    web-ext
    tool, change into the directory of the example extension
    you'd like to install, and type web-ext run. This will launch Firefox and
    install the extension automatically. This tool gives you some
    additional development features such as
    automatic reloading.

Support for other browsers

These examples are only tested in Firefox. They may work in other browsers, if the browser supports the APIs used. Note though that these examples all use the name browser for the namespace and use 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 on this.

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 find a problem, please file a bug.

If you need help, email the dev-addons mailing list or contact the WebExtensions team in the #webextensions IRC channel on irc.mozilla.org.

Contributing

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

主要指標

概覽
名稱與所有者mdn/webextensions-examples
主編程語言JavaScript
編程語言JavaScript (語言數: 5)
平台
許可證Mozilla Public License 2.0
所有者活动
創建於2015-08-14 19:55:54
推送於2025-05-13 04:21:44
最后一次提交
發布數0
用户参与
星數4.3k
關注者數162
派生數2.6k
提交數533
已啟用問題?
問題數246
打開的問題數14
拉請求數229
打開的拉請求數7
關閉的拉請求數71
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?