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!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to get menuID on Android in javascript

  • 1 cavab
  • 1 has this problem
  • 4 views
  • Last reply by 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.

All Replies (1)

more options