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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

bunny


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.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

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

Neil-4
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.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul