Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 355
yifanwu Avatar asked Aug 10 '14 05:08

yifanwu


2 Answers

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() {});
});
like image 154
Aniket Thakur Avatar answered Sep 23 '22 00:09

Aniket Thakur


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

var updateProperties = { 'active': true };
chrome.tabs.update(tabId, updateProperties, (tab) => { });
like image 31
abraham Avatar answered Sep 23 '22 00:09

abraham