Pretraži podršku

Izbjegni prevare podrške. Nikad te nećemo tražiti da nas nazoveš, da nam pošalješ telefonski broj ili da podijeliš osobne podatke. Prijavi sumnjive radnje pomoću opcije „Prijavi zlouporabu”.

Learn More

How to get menuID on Android in javascript

  • 1 odgovor
  • 1 ima ovaj problem
  • 4 prikaza
  • Posljednji odgovor od 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.

Svi odgovori (1)

more options