Reputation: 2042
I'm working on an addon and I would like to change the index of a tab. Is it possible to do it in XUL, I Already know how to make it with jetpack but I have to work with XUL. Any idea ? thanks
Upvotes: 0
Views: 151
Reputation: 37238
It absolutely is.
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
var mostRecentChromeBrowserWin = Services.wm.getMostRecentWindow('navigator:browser');
if (mostRecentChromeBrowserWin.gBrowser && mostRecentChromeBrowserWin.gBrowser.tabContainer) {
mostRecentChromeBrowserWin.gBrowser.selectedTab = mostRecentChromeBrowserWin.gBrowser.tabContainer.childNodes[0]; //make the 0 here there number, it starts with 0
}
Upvotes: 1