开发者

get url of all tabs in a firefox window (if posssible all ff windows)

开发者 https://www.devze.com 2022-12-30 11:21 出处:网络
I can retrieve the url of current tab in firefox using var wm = Components.classes[\"@mozilla.org/appshell/window-mediator;1\"] .getService(Components.interfaces.nsIWindowMediator);

I can retrieve the url of current tab in firefox using

var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator);

var mainWindow = wm.getMostRecentWindow("navigator:browser");

var tabbrowser = mainWindow.gB开发者_StackOverflow社区rowser;

var url = tabbrowser.currentURI.spec;

Now i want to do it for all tabs and save it in a string and if possible get it for tabs in the other ff windows as well. How can i do that?


I have this requirement also, happens to find that you just got so close to the answer. Check this example in official document, it has all your needs. The key point is the window enumerator.

https://developer.mozilla.org/En/Code_snippets/Tabbed_browser#Reusing_tabs

0

精彩评论

暂无评论...
验证码 换一张
取 消