Chrome-Extension: iterate through all tabs?

后端 未结 4 1049
小蘑菇
小蘑菇 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:33

    It appears this method has been deprecated in favor of chrome.tabs.query:

    http://developer.chrome.com/extensions/tabs.html#method-query

    So now you'd want to do:

    chrome.tabs.query({}, function(tabs) { /* blah */ } );
    

    Passing an empty queryInfo parameter would return all of the tabs.

提交回复
热议问题