Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

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,