views:

56

answers:

1

I want to develop an extension that activates only for a specific domain.
I don't want it to appear in browser menus while not browsing this specific domain.

Is it possible to do that?

+1  A: 

Possible: for the menus you could add a popupshowing listener that checks the currently loaded URL (docs for the context menu, where this would make the most sense).

You can also update always visible elements (like status bar icons) whenever the currently displayed URL is changed. This is done via gBrowser.addEventListener.

Nickolay
and what about the toolbar button,short-key, status bar button? Can I do the same?
ronik
Well, when the button is clicked, you can check the current URL and not do anything if you don't need to. Hiding a toolbar button dynamically would be annoying.
Nickolay
I need exactly the hiding, the addon is beeing devloped for a specific domain only.
ronik
you noticed that I edited my answer to cover your second question, right?
Nickolay
regarding your update, after these events get triggeredm how do I hide/unhide the items from all the menus?
ronik
this is starting to look as a "give me teh codes" exercise. I'm sure you can find an answer to this question on your own.
Nickolay
whatever... you don't have to answer.
ronik