Forum Discussion

reydimaano's avatar
reydimaano
Contributor
12 years ago

SelectTab function is not working

Using Tabbed Browsing



// Activates the browser tab where the specified URL is opened

function SelectTab(URL)

{

  var browser = Sys.Browser();

  var tabBand;



  switch (browser.ProcessName)

  {

    case "iexplore":

      if (browser.FileVersionInfo.MajorPart == 6)

      {

        Log.Error("The SelectTab operation is not supported in Internet Explorer 6 because it does not have tabbed browsing.");

        return;

      }

      tabBand = browser.BrowserWindow(0).CommandBar.TabBand;

      break;

    case "firefox":

      tabBand = browser.UIPage("chrome://browser/content/browser.xul").TabBand;

      break;

    default:

      Log.Error("The SelectTab operation is not supported in " + browser.ProcessName + ".");

      return;

  }



  var page = browser.WaitPage(URL, 0);

  if (! page.Exists)

  {

    Log.Error("Browser tab \"" + URL + "\" was not found.");

  }

  else

  {

    tabBand.TabButton(page.contentDocument.title).Click();

  }

}



I checked the Object Browser and found out the CommandBar->TabBand doesn't have any tab buttons at all although I have 2 tabs opened in the browser.  I'm using IE10.