Get the urls of all the tabs in all windows using chrome extension

后端 未结 2 656
暗喜
暗喜 2020-12-13 15:20

Is this possible for chrome extension to get all the URLs in all tabs using chrome extension ?

I have got the url of current Tab using this code

chro         


        
相关标签:
2条回答
  • 2020-12-13 15:22

    With chrome.tabs.query method, you can also simply do,

     chrome.tabs.query({},function(tabs){     
        console.log("\n/////////////////////\n");
        tabs.forEach(function(tab){
          console.log(tab.url);
        });
     });
    
    0 讨论(0)
  • 2020-12-13 15:34

    You could do something like this:

    chrome.windows.getAll({populate:true},function(windows){
      windows.forEach(function(window){
        window.tabs.forEach(function(tab){
          //collect all of the urls here, I will just log them instead
          console.log(tab.url);
        });
      });
    });
    
    0 讨论(0)
提交回复
热议问题