Search code examples
google-chrome-extension

is there a way to focus on a specific tab in chrome (via plugin)


I want to be able to focus on a specific tab.

After chrome.tabs.query I get the id but how do I set focus on that tab? I don't see this option in the documentation.


Solution

  • You should be able to do this with chrome.tabs.update.

    var updateProperties = { 'active': true };
    chrome.tabs.update(tabId, updateProperties, (tab) => { });