Tony
Tony

Reputation: 3489

XUL get current tab index number

i wanted to know how can i get the index of the current tab with xul. I've this to create and save the current index of a new created tab:

Some code:

button.indexTabs = gBrowser.addTab(askUrl);         
button.newTabBrowser = gBrowser.getBrowserForTab(button.indexTabs);

How can i get the index of the actual current tab (created or not)?

Thx.

Upvotes: 0

Views: 863

Answers (1)

Kashif
Kashif

Reputation: 1263

Use gBrowser.tabContainer.selectedIndex to get the index of selected tab. You can also find the selected tab directly by gBrowser.selectedTab

Note that in Javascript module (or in SeaMonkey) you don't have access to gBrowser. You will have to find the browser XUL window by getMostRecentWindow and look for element with id content. This element corresponds to gBrowser.

Upvotes: 3

Related Questions