[Project_owners] Enumerating tab URLs in Mozilla/Seamonkey/Netscape

Eric Jung grimholtz at yahoo.com
Wed Jul 13 11:56:14 EDT 2005


Hi,
I have this code which works great in FF, but not in
Mozilla/Seamonkey/Netscape. I'm trying to get a list of URLs of all
open tabs in all open browsers. Anyone know how to do it for non-FF
browsers?

Thanks in advance,
Eric Jung

  var urls = new Array();
  var wm =
    Components.classes["@mozilla.org/appshell/window-mediator;1"]
    .getService(Components.interfaces.nsIWindowMediator);
  var browserEnumerator = wm.getEnumerator("navigator:browser");

  while (browserEnumerator.hasMoreElements()) {
    var browserInstance =
      browserEnumerator.getNext().document.getElementById("content");
    // Check each tab of this browser instance
    var numTabs = browserInstance.mPanelContainer.childNodes.length;
    for (var index=0; index<numTabs; index++) {
      var currentTab = browserInstance.getBrowserAtIndex(index);
      urls.push(currentTab.currentURI.spec);
    }
  } 


		
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
 


More information about the Project_owners mailing list