It’s been a while since we published a guide on extension development in this blog, and we recently discovered that many of you are hitting a very old blog post about it. There’s plenty of documentation out there, but it can be hard to find, so here’s an overview of what you need to know about extension development.
As with everything Mozilla, the first place you should look for developer documentation is the Mozilla Developer Network. There’s an add-ons section there where you will find everything you need to know about how to develop Firefox extensions, as well as other add-on types.
There are a couple different ways to go about creating an extension for Firefox, so I covered each in the sections below.
Add-ons SDK extensions
The Add-ons SDK is a set of simple APIs you can use to quickly build good Firefox extensions. It’s what we recommend for new developers. It should be easy to work with, especially if you’re familiar with Google Chrome extensions or userscripts. It abstracts away most of the XUL / XPCOM infractrusture in Firefox, giving you a more familiar HTML and JS environment to work with.
The current approach to building an SDK extension is to download and set up the SDK, code locally, then package your extension (an XPI file) using the cfx tool included with the SDK. The SDK team is working on making this process much easier by integrating it into Firefox developer tools. Soon you’ll be able to build your extensions very quickly, right from Firefox.
You can learn more about the SDK and get help here:
- Documentation on MDN.
- Articles in this blog.
- Stack Overflow.
- Add-ons forum.
- #jetpack channel on Mozilla IRC.
Bootstrapped extensions
Bootstrapped extensions don’t require a restart to be installed, like SDK extensions, but they don’t have the easy access to SDK APIs or sandboxing. You’re basically doing everything manually, like tracking windows to add or remove your UI. However, there are various great tools available to you via existing JavaScript Modules, like CustomizableUI.jsm for toolbar UI and Services.jsm for frequently used Firefox components.
Compared to the old way of making extensions (see Overlay extensions below), the only notable loss are overlays. Bootstrapped extensions have the bootstrap.js file instead, which is what serves as the starting point for your code. Otherwise, everything should be familiar to you: install.rdf, chrome.manifest and code files, all packed in a ZIP file with a .xpi extension.
Other than Bootstrapped extensions on MDN and the pages they link to, all the available developer resources are the same for overlay extensions (see below).
Firefox for Android extensions
Extensions in Firefox for Android are slightly different. Since the UI is native instead of XUL, the way extensions can modify it is different and a bit more limited. This also means overlay extensions are not supported, so your options are the SDK and bootstrapped extensions.
Since mobile applications have very limited screen real estate, browsers need to maximize the content area, meaning extensions can’t add buttons or toolbars to the browser. However, the Firefox for Android team recently developed the Firefox Hub API that lets extensions add their content to the home page. This is a smart place to put your extension UI if you need it.
You can learn more about Firefox for Android extensions and get help here:
- Documentation on MDN.
- Add-ons forum.
- #extdev and #mobile channels on Mozilla IRC.
Overlay extensions
Overlay extensions are the old way of making add-ons. It might still make sense for you to use this approach if you need to create a very complex overlay or have other specific needs. However, having to restart Firefox to install this kind of extension is annoying because it breaks the user’s workflow, so you should definitely consider using the SDK or bootstrapped extensions first.
You can get help about extension development in general here:
- Documentation on MDN.
- Articles in this blog.
- Add-ons forum.
- #extdev channel on Mozilla IRC.
相关推荐
How to develop a Network Security Policy
- **"How to use the Junit in JDeveloper.doc"**:这个文档很可能是关于如何在JDeveloper中集成和使用JUnit进行单元测试的指南。JUnit是一个流行的Java测试框架,JDeveloper支持其集成,使得开发者能够在IDE内部...
How To Write A Dissertation
i write a document for how to config the Python 3.0 environment. it can help the Python newer
How to read a book efficiently. Part one The dimensions of reading Part two The third level of reading Part three Approaches to different kinds of reading Part four The ultimate goals of reading
VTK 12 How to Write a Process__ Object.pdf VTK 12 How to Write a Process__ Object.pdf VTK 12 How to Write a Process__ Object.pdf
标题《How to make apps for Firefox OS》指出了本文的核心内容,即指导读者如何为Firefox OS操作系统开发应用程序。Firefox OS是基于网页技术(HTML5, CSS, JavaScript)开发的操作系统,旨在通过网络API(Web API...
Swift 5 for Absolute Beginners: Learn to Develop Apps for iOS, 5th Edition by Stefan Kaczmarek English | 2019 | ISBN: 1484248676 | 360 Pages | True PDF Stay motivated and overcome obstacles while ...
How to Read a Book,学习如何快速读书 科学读书,第一版出版于1940年
This is a document about "How to be a star engineer". Share it to you .
how to read a book ,it teach you reading skills
Chapter 5 How to List the Authors and Addresses Chapter 6 How to Prepare the Abstract Chapter 7 How to Write the Introduction Chapter 8 How to Write the Materials and Methods Section Chapter 9 How to ...
C++ How to Program presents leading-edge computing technologies in a friendly manner appropriate for introductory college course sequences, based on the curriculum recommendations of two key ...
MIT计算机大牛Bill Freeman教授于2014年写的报告,虽然比较久远,但非常有参考意义。How to write a good CVPR submission
(How to Write a (Lisp) Interpreter (in Python))和(An ((Even Better) Lisp) Interpreter (in Python))的翻译,对解释器实现原理和函数式编程敢兴趣的可以下载看看!
Think Java: How to Think Like a Computer Scientist by Allen B. Downey, Chris Mayfield 2016 | ISBN: 1491929561 Currently used at many colleges, universities, and high schools, this hands-on ...
这是一篇关于如何找到一份体面的工作的英文作文,里面语法非常丰富,是作者的呕心之作