[Project_owners] Opening links in tabs

David Murray lid2000 at aanet.com.au
Tue Feb 13 22:23:50 PST 2007


This is what I have in my extension and it seems to work:

var browserWindow = GetWindowByType("navigator:browser");
			if (browserWindow) {
				browserWindow.delayedOpenTab(url);
			}

David.



Jan Wrobel wrote:
> Hi,
> 
> I have some links in my extension window that I want to be opened in
> new Firefox tabs when user clicks on them. I use following code:
> var wm =
> Components.classes["@mozilla.org/appshell/window-mediator;1"].
>       getService(Components.interfaces.nsIWindowMediator);
> var win = wm.getMostRecentWindow("navigator:browser");
> win.gBrowser.selectedTab = win.gBrowser.addTab(url);
> 
> It works fine except that my extension window hides under Firefox
> window when link is clicked and I want it to stay on top. I've
> found few extensions that open links exactly in a way I want, but I
> can't find any difference in a javascript or xul source code that is
> responsible for this behaviour.
> 
> Do you know how to solve this problem?
> 
> Cheers,
> Jan


More information about the Project_owners mailing list