(This article is also posted on Mozilla
Hacks.)
You might have heard about Mozilla’s WebExtensions, our
implementation of a new browser extension API for writing
multiprocess-compatible add-ons. Maybe you’ve been wondering what it was about,
and how you could use it. Well, I’m here to help! I think MDN’s WebExtensions
Docs have a pretty great definition:
WebExtensions are a new way to write Firefox extensions.
The technology is developed for cross-browser compatibility: to a large extent
the API is compatible with the extension API supported by Google
Chrome and Opera. Extensions written for these browsers will in most cases run
in Firefox with just a few changes. The API is also fully compatible with
multiprocess Firefox.
The only thing I would add is that while Mozilla is implementing most of the API
that Chrome and Opera support, we’re not restricting ourselves to only that API.
Where it makes sense, we will be adding new functionality and talking with other
browser makers about implementing it as well. Finally, since the WebExtension
API is still under development, it’s probably best if you use Firefox
Nightly for this tutorial, so that you get the most up-to-date,
standards-compliant behaviour. But keep in mind, this is still experimental
technology — things might break!
Starting off
Okay, let’s start with a reasonably simple add-on. We’ll add a button, and when
you click it, it will open up one of my favourite sites in a new
tab.
Read more…