mozilla
Your Search Results

    fuelIWindow

    FUEL is deprecated as of Firefox 40. Consider using the Add-ons SDK instead

    The FUEL Window object describes a browser window.

    Method overview

    fuelIBrowserTab open(in nsIURI aURI)

    Attributes

    Attribute Type Description
    tabs readonly attribute nsIVariant An array of browser tabs (fuelIBrowserTab) within the browser window. This array is a snapshot of the opened tabs, changes to the array don't affect the tabs in the browser. To manipulate tabs, use the fuelIWindow.open() method described on this page or various methods on fuelIBrowserTab
    activeTab readonly attribute fuelIBrowserTab The currently-active tab within the browser window.
    events readonly attribute fuelIEvents The events object for the browser window. supports: "TabOpen", "TabClose", "TabMove", "TabSelect"

    Methods

    open()

    Open a new browser tab, pointing to the specified URI.

    fuelIBrowserTab open(
      in nsIURI aURI
    );
    

    Parameters

    aURI
    The URI to load in the new browser tab.

    Example

    This example sets up an event listener to watch for the "TabOpen" event, which is sent when a new tab is created, then opens a new window, loading the Mozilla web site into it. When the tab is created into which the Mozilla site is loaded, the onTabOpen() method in the example is called.

    This demonstrates several useful techniques, including how to create a new tab in a window as well as how to obtain a reference to a newly-opened tab.

    // Helper for making nsURI from string
    function url(spec) {
      var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
      return ios.newURI(spec, null, null);
    }
    
    function onTabOpen(event) {
      // Note that alert does not work, as the event gets called before the tab is loaded.
      var theTab = event.data.tab;    // Get the FUEL BrowserTab object for the tab
      Application.console.log("It opened");
    }
    
    var activeWin = Application.activeWindow;
    activeWin.events.addListener("TabOpen", onTabOpen);
    
    var browserTab = activeWin.open(url("http://mozilla.org"));
    

    See also

    Document Tags and Contributors

    Last updated by: teoli,