Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

Learn More

How to get menuID on Android in javascript

  • 1 réponse
  • 1 a ce problème
  • 3 vues
  • Dernière réponse par 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.

Toutes les réponses (1)

more options