Highlighted tabs in chrome extension API

2.8k Views Asked by At

Please give me an advice on chrome extension API. I'm trying to write a code that would do the same thing like when I highlight all the tabs in chrome, click the right button on them and choose reload, so all the tabs get reloaded together at once. I have no problems with highlighting the tabs, but how can I apply some operation to those highlighted tabs ?

1

There are 1 best solutions below

0
On

Applying operations on a set of tabs requires passing the tab ID(s) to the respective methods in the chrome.tabs API.

So, in your case, simply remember the tab IDs of the tabs you highlighted programmatically (or use chrome.tabs.query to fetch them) and call chrome.tabs.reload sequentially, passing a single tab ID per invocation. (Unfortunately, the API does not accept an array of IDs, so you'll have to pass them one by one.)