mozilla
Your Search Results

    fuelIBrowserTab

    The FUEL BrowserTab object describes a tab in a browser.

    Method overview

    void load(in nsIURI aURI)
    void focus()
    void close()
    void moveBefore(in fuelIBrowserTab aBefore)
    void moveToEnd()

    Attributes

    Attribute Type Description
    uri readonly attribute nsIURI The current uri of this tab.
    index readonly attribute PRInt32 The current index of this tab in the browser window.
    window readonly attribute fuelIWindow The browser window that is holding the tab.
    document readonly attribute nsIDOMHTMLDocument The content document of the browser tab. See the documentation of the Document object in the DOM reference.
    events readonly attribute fuelIEvents The events object for the browser tab. supports: "load"

    Methods

    load()

    Load a new URI into this browser tab.

    void load(
      in nsIURI aURI
    );
    
    Parameters
    aURI
    The uri to load into the browser tab

    focus()

    Give focus to this browser tab, and bring it to the front.

    void focus();
    
    Parameters

    None.

    close()

    Close the browser tab. This may not actually close the tab as script may abort the close operation.

    void close()
    
    Parameters

    None.

    moveBefore()

    Moves this browser tab before another browser tab within the window.

    void moveBefore(
      in fuelIBrowserTab aBefore
    );
    
    Parameters
    aBefore
    The tab before which the target tab will be moved.

    moveToEnd()

    Move this browser tab to the last tab within the window.

    void moveToEnd();
    
    Parameters

    None.

    Examples

    Iterating over the tabs in a window

    This example iterates over all the tabs in the currently active browser window, displaying an alert for each one.

    var activeWin = Application.activeWindow;
    
    // look at each open tab in the active browser window
    activeWin.tabs.forEach( function(tab) {
      alert(tab.uri.spec);
    });
    

    Accessing the web content in a tab

    This example obtains the HTML content from the active tab.

    // access the webcontent document of the active tab
    alert(activeWin.activeTab.document.body.innerHTML);
    

    Opening a new tab and inserting contents into it

    This example creates a new tab in the active window, then inserts some HTML content into it.

    // 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);
    }
    
    // opening a new tab and modifying the contents
    newTab = Application.activeWindow.open(url("about:blank"));
    newTab.events.addListener("load", function() { newTab.document.body.innerHTML = "<H1>HelloWorld</H1>"; });
    

     

    Document Tags and Contributors

    Last updated by: Sheppy,