Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Pesquisar no site de suporte

Evite golpes de suporte. Nunca pedimos que você ligue ou envie uma mensagem de texto para um número de telefone, ou compartilhe informações pessoais. Denuncie atividades suspeitas usando a opção “Denunciar abuso”.

Learn More

How to get menuID on Android in javascript

  • 1 resposta
  • 1 tem este problema
  • 4 visualizações
  • Última resposta de Kevin

more options

Firefox on Android exposes a useful API to add/remove menu items in the main menu using javascript. This is usually done in addons.

From all sorts of examples like https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/NativeWindow/menu I learned how to add a menu item, get its menuID and using the menuID remove it later if needed.

What I was not able to find is a way to obtain the menuID of an already existing menu item, things which are in the menu by default.

The problem is that when a menu item is added the menu.add method returns the menuID which can be used later, but if the menu item is already there I don't know of a way of getting its menuID. I also don't know how to get a list of all already added menuIDs, this would be helpful too.

Firefox on Android exposes a useful API to add/remove menu items in the main menu using javascript. This is usually done in addons. From all sorts of examples like https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/NativeWindow/menu I learned how to add a menu item, get its menuID and using the menuID remove it later if needed. What I was not able to find is a way to obtain the menuID of an already existing menu item, things which are in the menu by default. The problem is that when a menu item is added the menu.add method returns the menuID which can be used later, but if the menu item is already there I don't know of a way of getting its menuID. I also don't know how to get a list of all already added menuIDs, this would be helpful too.

Todas as respostas (1)

more options