Chrome-Extension: iterate through all tabs?

Skizit picture Skizit · Mar 23, 2011 · Viewed 28.2k times · Source

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

Answer

Golden Flying Broom picture Golden Flying Broom · Mar 7, 2013

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.