FireFox Toolbar Open Window in new Tab
I have a Toolbarbutton
<toolbarbutton context="TabMenue" id="esbTb_rss_reader" label=开发者_JAVA技巧"News" type="menu">
with a Context menue which comes up when the button is right clickt
<menupopup id="TabMenue" >
<menuitem label="New Tab" oncommand="esbTb_loadURLNewTab()"/>
</menupopup>
so this function should open the new window in a new tab
function esbTb_loadURLNewTab() {
window.open(ClickUrl,'name'); }
I don't get it working that the new Window is showing up in a new tab it always opens a new firefox window.
I tried also like described in this article to set the browser.link.open_newwindow and browser.link.open_newwindow.restriction preferences but that doesn't bringt anything. And I tried it with all Target attributes which came in my mind.
So I'm grateful for any hints, tips what ever this is driving me crazy...
This should help: Opening a URL in a new tab.
But to give a start (more or less copy&paste):
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var recentWindow = wm.getMostRecentWindow("navigator:browser");
recentWindow.delayedOpenTab(url, null, null, null, null);
精彩评论