Visit Mozilla.org

FUEL:BrowserTab

From MDC

This article covers features introduced in Firefox 3

Contents

[edit] Method overview

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

[edit] 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.
events readonly attribute fuelIEvents The events object for the browser tab. supports: "load"

[edit] Methods

[edit] load()

Load a new URI into this browser tab.

void load(in nsIURI aURI)
[edit] Parameters
aURI
The uri to load into the browser tab
[edit] Return value


[edit] focus()

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

void focus()
[edit] Parameters
[edit] Return value


[edit] close()

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

void close()
[edit] Parameters
[edit] Return value


[edit] moveBefore()

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

void moveBefore(in fuelIBrowserTab aBefore)
[edit] Parameters
aBefore
The tab before which the target tab will be moved
[edit] Return value


[edit] moveToEnd()

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

void moveToEnd()
[edit] Parameters
[edit] Return value

[edit] Examples

var activeWin = Application.activeWindow;

// look at each open tab in the active browser window
activeWin.tabs.forEach( function(tab) {
  alert(tab.uri.spec);
});
// access the webcontent document of the active tab
alert(activeWin.activeTab.document.body.innerHTML);
// 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>"; });

[edit] HelloWorld

"; });

</pre>

[edit] See also