MDN wants to learn about developers like you:


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 displays a doorhanger attached to a Firefox for Android tab.

Syntax, value, buttons, tabID, options);

The message displayed in the doorhanger.

This is a string-based tag for the doorhanger, used as an argument to NativeWindow.doorhanger.hide().

This is an array of button objects, once for each choice to offer the user. Each button has two attributes:
  • label: a string to display on the button
  • callback: a function that will be called when the button is selected

The ID of the tab the doorhanger should be attached to. You can retrieve the tabID using the BrowserApp object: for example, returns the ID of the active tab.

Additional options for the doorhanger. Two options are currently defined:
  • timeout: a time in milliseconds. The notification will not automatically dismiss before this time.
  • persistence: an integer. The notification will not automatically dismiss for this many page loads. If persistence is set to -1, the doorhanger will never automatically dismiss.


In the example below, an add-on adds a new menu item labeled "Offer cake" which constructs and shows a new doorhanger when selected.

The doorhanger contains two buttons, which just show different toast messages when selected.

var menuID;  
function offerCake(window) {  
  let buttons = [  
      label: "Yes, please!",  
      callback: function () { "yum", "short");  
      label: "Not today",  
      callback: function () { "still hungry", "short");  
  let message = "How about some cake?";  
  let options = {  
    persistence: 1  
  };, "cake-request", buttons,, options);  
function loadIntoWindow(window) {  
  if (!window)  
  menuID ="Offer cake", null, function(){    
function unloadFromWindow(window) {  
  if (!window)  

See Also

Document Tags and Contributors

 Last updated by: wbamberg,