AJ00200
AJ00200

Reputation: 17287

How to add UI elements from a bootstraped Firefox addon

I am writing a Firefox addon for Firefox 4 which allows you to create bootstraped addons (addons that do not require a restart of the browser), however, they do not allow you to use XUL to create UI elements. What is an easy way to create UI elements in places like the tools menu (with JavaScript), and how do I make my addon open a new window to interface with the browser?

Upvotes: 1

Views: 354

Answers (2)

AJ00200
AJ00200

Reputation: 17287

The Mozilla Add-on SDK which is also known as JetPack has evolved to the point where it can be used to create entire add-ons. Not only are the add-ons fast and simple to create, but they are also restartless.

The best way to add UI elements with the SDK is to use the Widget API which will easily allow you to add an icon to the status bar. There are also other APIs for the context-menu and creating panels.

Upvotes: 1

Nickolay
Nickolay

Reputation: 32063

It's not easy right now. You need to keep track of browser windows as they open and close and add your UI to each window manually via DOM APIs

See how it's implemented in the Addon (formerly Jetpack) SDK: https://github.com/mozilla/addon-sdk/blob/master/packages/addon-kit/lib/widget.js#L215 (browserManager, in case the line numbers change).

Upvotes: 3

Related Questions