Chrome-Extension: iterate through all tabs?

后端 未结 4 1052
小蘑菇
小蘑菇 2021-02-03 22:23

How would I iterate through all tabs a user has open and then check if they have a particular HTML item with id = \'item\'?

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 22:29

    I use this one

    chrome.tabs.getAllInWindow(null, function(tabs) {
          $.each(tabs, function() {
            // u can use 'this.id' to work with evey tab 
          });
    });
    

提交回复
热议问题