Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting a reference to the sidebar window

4 views
Skip to first unread message

Alex Iskold

unread,
Oct 12, 2006, 9:01:33 PM10/12/06
to

How can i get a reffrence to the current window's sidebar from a
XUL page loaded into the browser (not the sidebar)?"

Thanks!

Alex

--
alex iskold
founder & cto
http://www.adaptiveblue.com


Nickolay Ponomarev

unread,
Oct 13, 2006, 3:09:12 AM10/13/06
to Alex Iskold, dev-ext...@lists.mozilla.org
Assuming you have chrome privileges, this should work:
var Ci = Components.interfaces;

var topLevelWindow =
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow)
.QueryInterface(Ci.nsIDOMChromeWindow);
var sidebar = topLevelWindow.document.getElementById("sidebar");
alert(sidebar.contentDocument);

Nickolay

> _______________________________________________
> dev-extensions mailing list
> dev-ext...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-extensions
>

0 new messages