Visit Mozilla.org

FUEL:Window

From MDC

This article covers features introduced in Firefox 3

Contents

[edit] Method overview

fuelIBrowserTab open(in nsIURI aURI)

[edit] Attributes

Attribute Type Description
tabs readonly attribute nsIVariant A collection of browser tabs within the browser window.
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"

[edit] Methods

[edit] open()

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

fuelIBrowserTab open(in nsIURI aURI)
[edit] Parameters
aURI
The uri to open the browser tab to
[edit] Return value

[edit] Examples

// 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.
  Application.console.log("It opened");
}

var activeWin = Application.activeWindow;
activeWin.events.addListener("TabOpen", onTabOpen);

var browserTab = activeWin.open(url("http://mozilla.org"));

[edit] See also