Ada ralat skrip pada halaman ini. Sementara ralat ini akan dimaklumi oleh editor laman, anda boleh lihat sebahagian kandungannya di bawah.
Terjemahan ini belum lengkap. Sila bantu terjemahkan artikel ini daripada Bahasa Inggeris.
Add-ons add new functionality to Gecko-based applications such as Firefox, SeaMonkey, and Thunderbird. There are two main types of add-on: Extensions add new features to the application, while Themes modify the application's user interface.
Add-ons can greatly affect the behavior of the application that hosts them. We've developed a set of guidelines to help ensure that they provide a good experience to users. These guidelines apply for all sorts of add-ons, whether they are hosted at addons.mozilla.org or not.
Extensions add new functionality to Mozilla applications such as Firefox and Thunderbird. They can add new features to the browser, such as a different way to manage tabs, and they can modify web content to improve the usability or security of particular websites.
There are three different techniques you can use to build extensions: Add-on SDK-based extensions, manually bootstrapped restartless extensions, and legacy extensions.
- Add-on SDK extensions
- Restartless extensions
Extensions which don't require a browser restart to install.
- Legacy extensions
Legacy extensions which require a browser restart to install, generally using XUL overlays.
We're working on a system called WebExtensions, which is a new way to develop WebExtensions for Firefox, that will be largely compatible with the system used by Chrome and Opera.
In the future this will be the preferred way to develop extensions for Firefox.
At the moment the implementation of this is experimental, but you can see the docs here if you want to give it a spin.
If you can, it's advisable to use the Add-on SDK, which uses the restartless extension mechanism but simplifies certain tasks and cleans up after itself. If the Add-on SDK isn't sufficient for your needs, implement a manual restartless extension instead.
For more information on choosing which technique to use, read this comparison.
Extension development is hard without being able to debug to see what lines errors were made on. You must enable the developer preferences in order for the logs to be show in the Browser Console. For desktop see here: Setting up an extension development environment.
For desktop follow Setting Up a Development Environment, for Mobile (Android/iOS) follow Debugging Firefox for Android with WebIDE which uses the "Browser Toolbox" from within the desktop WebIDE to catch errors occuring on the mobile device, for Firefox OS also use the WebIDE.
No matter how you develop an extension, there are some guidelines you can follow to help ensure your extension provides as good a user experience as possible.
Most of the documentation assumes you're developing for Firefox Desktop. If you're developing for some other Gecko-based application, there are major differences you need to know about.
Publishing your add-on
Mozilla operates a platform for reviewing, signing, and distributing add-ons and themes at addons.mozilla.org, also known as AMO.
You don't have to list your add-on on AMO, but starting in Firefox 43, you must submit your add-on to AMO so it can be reviewed and signed, or Firefox release users won't be able to install your add-on. If you do list your add-on on AMO, you can benefit from its visibility as a source for useful add-ons.
- Signing and distributing your add-on: how to get your add-on signed and published, whether it's listed on AMO or not.
- AMO review policies: the checks that are made on add-ons when they are reviewed.
- AMO API: the addons.mozilla.org website has an API that allows you to retrieve data about a single add-on, groups of add-ons, or to search add-ons.
- Policies for Featured add-ons: featured add-ons are top-quality extensions and themes highlighted on AMO, Firefox's Add-ons Manager, and across other Mozilla websites.
- AMO contact information
Other types of add-ons
Lightweight themes are much simpler to implement than complete themes, but provide very limited customization.
With complete themes you can make much deeper modifications to the application UI. The documentation for complete themes is out of date, but is linked to here as a possible basis for updated documentation.
Search engine plugins are a simple and very specific type of add-on: they add new search engines to the browser's search bar.
Plugins help the application understand web content that it does not natively support. NPAPI plugins are a legacy technology and new sites should not use them. In general, plugins are not available on most modern mobile systems including, and websites should transition away from using plugins.