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.
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.contextmenus.add() adds an item to the context menu in Firefox for Android, returning an ID for the item. To remove the item, use NativeWindow.contextmenus.remove(), passing in the item's ID.

Syntax

window.NativeWindow.contextmenus.remove(menuID);

menuID
The ID of the item to remove.

Example

The following example adds a new context menu item, stores the ID returned by add(), and later uses that ID to remove the item:

var menuID;  
      
function loadIntoWindow(window) {      
  if (!window)      
    return;  
  let label = "Show HTML";  
  let selector =  window.NativeWindow.contextmenus.SelectorContext("*");  
  menuID = window.NativeWindow.contextmenus.add(label, selector, function(target) {        
    window.NativeWindow.toast.show(target.outerHTML, "short");         
  });      
}      
         
function unloadFromWindow(window) {      
  if (!window)      
    return;      
  window.NativeWindow.contextmenus.remove(menuID);        
}

See Also

Document Tags and Contributors

 Contributors to this page: wbamberg, dkocho4, mehmetaergun, pink.devil.tanha, justinpotts
 Last updated by: wbamberg,