2

I port a Chrome extension to Firefox. Because the XUL-based API is quite different from Chrome API, so I use the new add-on SDK of firefox.

There is a interface called "widget" can be used to make a little icon button like "BrowserAction" of Chrome, but "widget" is on the bottom of window, "BrowserAction" is on the top right side of window.

Some firefox extensions, for example, GreaseMonkey , have widgets on the top right, so I'm asking how to implement it using add-on SDK, not XUL based API?

gideon
  • 19,329
  • 11
  • 72
  • 113
legendlee
  • 568
  • 4
  • 12
  • Adding buttons to the main toolbar isn't recommended starting with Firefox 4 even though some add-ons still do that, the add-on bar is there for extension icons. The user can always customize the toolbar however and move your widget to the main toolbar. – Wladimir Palant Dec 26 '11 at 07:46
  • Thank you, maybe I should follow the new style of Firefox. – legendlee Dec 26 '11 at 07:56
  • It's worth noting that the Jetpack project's proposed roadmap for 2012 addresses this issue as a top priority: https://wiki.mozilla.org/Jetpack/Roadmap#Move_Add-ons_to_top_of_browser – therealjeffg Dec 26 '11 at 21:43

1 Answers1

1

Erik Vold has created a library that allows you to do this:

https://github.com/erikvold/toolbarbutton-jplib/blob/master/lib/toolbarbutton.js

While this code isn't included in the SDK libraries, it can be used to get the result you want with the current version of the SDK. You can see a quick example using Erik's library here:

https://builder.addons.mozilla.org/addon/1031142/latest/

therealjeffg
  • 5,790
  • 1
  • 23
  • 24