Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

remove

This article needs a technical review. How you can help.

The NativeWindow object is only available to privileged code running on Firefox for Android, and is intended for use by Firefox for Android add-ons.

Summary

NativeWindow.menu.add() adds an item to the main menu in Firefox for Android, returning an ID for the item. To remove the item, use NativeWindow.menu.remove(), passing in the item's ID.

Syntax

window.NativeWindow.menu.remove(menuID);

menuID
The ID of the item to remove.

Example

The following example adds a menu item with the label "Show Toast", which displays a toast notification when clicked:

function showToast(window) {  
  window.NativeWindow.toast.show("Showing you a toast", "short");  
}  
 
var menuID;  
 
function addMenuItem(window) {  
  menuID = window.NativeWindow.menu.add("Show Toast", null, function(){  
    showToast(window);   
  });  
}  
 
function removeMenuItem(window) {  
  window.NativeWindow.menu.remove(menuID);  
}

See Also

Document Tags and Contributors

 Contributors to this page: wbamberg, justinpotts
 Last updated by: wbamberg,