[Project_owners] Opening links in tabs

xeen aka.xeen at gmail.com
Wed Feb 14 04:33:49 PST 2007


makeOnTop: function(what) {
		try {
		  var xulWin =
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem).treeOwner.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIXULWindow);
			xulWin.zLevel = (what)?xulWin.raisedZ:xulWin.normalZ;
		} catch(e) {}
},

Call it with true to make whatever window. refers to on top and call
it with false to make it behave normally again. The code came from
some version of console^2 extension, so credits to the author.
xeen

On 2/14/07, Frederik Vanderstraeten <frederik_vanderstraeten at yahoo.co.uk> wrote:
> Try calling window.focus() right after loading the tab. It's kind of a
> hack but it will probably work.
>
> Jan Wrobel schreef:
> > On Wed, 14 Feb 2007, David Murray wrote:
> >
> >> This is what I have in my extension and it seems to work:
> >>
> >> var browserWindow = GetWindowByType("navigator:browser");
> >>                      if (browserWindow) {
> >>                              browserWindow.delayedOpenTab(url);
> >>                      }
> >
> > It works in the same way - Firefox window goes on top of the extension
> > window when link is clicked. I think this may be caused by some xul
> > propertie of the extension window but I can't figure out which one.
> >
> > Jan
> >
> >> 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
> >> _______________________________________________
> >> Project_owners mailing list
> >> Project_owners at mozdev.org
> >> http://mozdev.org/mailman/listinfo/project_owners
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners at mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> >
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list