...">

FireFox Toolbar Open a window in a new tab

I have a toolbar

<toolbarbutton context="TabMenue" id="esbTb_rss_reader" label="News" type="menu"> 

with a context menu that appears when the button is in the right click

 <menupopup id="TabMenue" > <menuitem label="New Tab" oncommand="esbTb_loadURLNewTab()"/> </menupopup> 

so that this function opens a new window in a new tab

 function esbTb_loadURLNewTab() { window.open(ClickUrl,'name'); } 

It doesn’t turn out that a new window appears on a new tab, it always opens a new firefox window.

I also tried to describe in this article to set the parameters browser.link.open_newwindow and browser.link.open_newwindow.restriction, but it does not bring anything. And I tried this with all the Target attributes that came to my mind.

So, I am grateful for any hints, suggests that this will ever drive me crazy ...

+4
source share
1 answer

This should help: Opening the URL in a new tab .

But give a start (more or less copy and 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); 
+2
source

Source: https://habr.com/ru/post/1334239/