javascriptgoogle-chromefirefoxfirefox-addonfirefox-addon-sdk

What is the easiest way to develop Firefox extension?


I'm planning to develop a simple Firefox extension that will shorten URL of a currently active tab, display a popup with the shortened URL, and place it into the clipboard.

In Google Chrome, this would be pretty easy (according to http://developer.chrome.com/extensions/getstarted.html) -- pure JavaScript plus a few calls to JavaScript API-s of interacting with the browser's UI.

However, after searching around for a good Firefox extensions tutorial, the most officially-looking links I found are:

According to them, it looks like I will have to learn the XUL language for even the simplest interactions with the browser's UI. On top of that, I will have to set up custom Firefox profile so as not to hose my default profile during development, create complicated directory structure, write manifest in obscure XML, figure out how to package and test whatever I implement, etc.

It's 2013, isn't there an easier way of building Firefox extensions?


Solution

  • It's 2013, isn't there an easier way of building Firefox extensions?

    Yes there is!

    The links you provided in the question are unbelievably outdated. There is a new, much better way of developing Firefox extensions -- Firefox Add-on SDK.

    However it's pretty hard to stumble upon it by just googling along the lines of 'firefox addon tutorial'. I'm amazed Mozilla doesn't advertise it more aggressively, or at least mention it on those pages you found.

    Steps to get started (Mac/Linux, but should be pretty similar for PC):

    All in all, it took me just a few hours to read the documentation, get familiar with the SDK API-s, find SDK module to place a widget onto a navigation bar instead of add-on bar, and develop fully-functional extension in just about 50 lines of JavaScript.

    HTH!

    Update

    There is a new standard, called WebExtensions

    From MDN

    There are currently several toolsets for developing Firefox add-ons, but WebExtensions will become the standard by the end of 2017.

    If you are writing a new add-on, we recommend that you write a WebExtension.