Reputation: 533
When calling chrome.tabs.highlight({'tabs': tabId}, function(){});
I'm getting this error:
Unchecked runtime.lastError while running tabs.highlight: No tab at index: 7355.
Upvotes: 10
Views: 3729
Reputation: 1267
Another important thing (in addition of using the tab index) is to provide the windowId
. This is not documented in the official chrome docs, but helps if a different window or inspector is active.
chrome.tabs.highlight({
windowId: tab.windowId,
tabs: tab.index
}, function () {});
Upvotes: 4
Reputation: 533
chrome.tabs.highlight requires a tab index, not a tabId. You can convert a tabId into an index using chrome.tabs.get:
chrome.tabs.get(tabId, function(tab) {
chrome.tabs.highlight({'tabs': tab.index}, function() {});
});
Upvotes: 18
Reputation: 77531
This function does not take tab IDs, but instead the tab indices (positions within the window)
Upvotes: 1