Reputation: 1645
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.
Upvotes: 18
Views: 20409
Reputation: 1
the easiest way to do this is with a extension of chrome "always active window"
Upvotes: 0
Reputation: 47833
You should be able to do this with chrome.tabs.update.
var updateProperties = { 'active': true };
chrome.tabs.update(tabId, updateProperties, (tab) => { });
Upvotes: 31
Reputation: 68915
You can also use https://developer.chrome.com/extensions/tabs#method-highlight
chrome.tabs.get(tabId, function(tab) {
chrome.tabs.highlight({'tabs': tab.index}, function() {});
});
Upvotes: 4