opening a new tab from the sidebar
I use this code to open a new tab from the sidebar:
the mainwindow code just came from the mozilla developer wiki
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
function gotoPage(url)
{
mainWindow.getBrowser().addTab(url);
}
the mainwindow code just came from the mozilla developer wiki
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
function gotoPage(url)
{
mainWindow.getBrowser().addTab(url);
}
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?so you can only do it in javascript
i'm using:
var win = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
function openInTab()
{
var link = document.getElementById("urlLabel").value;
win.openUILinkIn(link, 'tab');
} -
Inappropriate?thanks chris/Sen.
Loading Profile...




EMPLOYEE