We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS


« DOM Reference

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

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.


NativeWindow.doorhanger.show() displays a doorhanger attached to a Firefox for Android tab.


NativeWindow.doorhanger.show(message, 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, window.BrowserApp.selectedTab.id 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 () {  
        window.NativeWindow.toast.show("yum", "short");  
      label: "Not today",  
      callback: function () {  
        window.NativeWindow.toast.show("still hungry", "short");  
  let message = "How about some cake?";  
  let options = {  
    persistence: 1  
  window.NativeWindow.doorhanger.show(message, "cake-request", buttons, window.BrowserApp.selectedTab.id, options);  
function loadIntoWindow(window) {  
  if (!window)  
  menuID = window.NativeWindow.menu.add("Offer cake", null, function(){    
function unloadFromWindow(window) {  
  if (!window)  

See Also

Document Tags and Contributors

Last updated by: wbamberg,