I am making my first firefox extension today. So far I have done a little...but now I would like to count the number of firefox windows the user has open (for example 3) I can count tabs, that is easy so far...but I can't seem to find how to cycle through windows and count them (windows != tabs, like tabs are within windows, sorry, I hope this makes sense, even mozilla confuses it in their coding) I think basically, I am lost for the method name...
so I think it will be like:
var tomato = SOMETHING HERE MYSTERY DIFFICULT!!!!;
for (var i = 0; i < tomato; i++) {
WINDOW COUNTER HERE (EASY)
}
Any idea how to do this?
You're looking for nsIWindowMediator - a snippet from MDC:
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var enumerator = wm.getEnumerator(type);
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
// win is [Object ChromeWindow] (just like window), do something with it
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With