Re: How to find the different controls on a FireFox Browser. ?

Neil <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
bunny wrote:

>So the original question is to be able to find different controls on a XUL application. But to make it simpler, i want to be able to find various controls present on the Firefox browser through my JavaScript. I am trying to use the interfaces being exposed by XULRunner. The thing i have tried thus far.
>
>function findXULWindow(txt)
>{
>        var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
>                           .getService(Components.interfaces.nsIWindowMediator);
>        var enumerator = wm.getEnumerator("navigator:browser");
>        alert("1");
>        while(enumerator.hasMoreElements()) {
>                var win = enumerator.getNext();
>                alert("2");
>       }
>}
>
>This code when i run on a Firefox is part of extension to FF, gives me the reference of the top level xul window which in my case is the browser and the loop runs once for one open browser instance.
>
>What i am typically interested is in enumerating the different controls( forward \backward buttons, menus..etc ) available on the FireFox Browser.  Any pointers \help is much appreciated.
>  
>
Your win variable is the DOM window of the browser, so you can grab the 
win.document from that and then use any of the regular DOM methods (e.g. 
getElementByID) on that.

-- 
Warning: May contain traces of nuts.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.