Chrome.tabs.highlight gives error "No tab in index"
When called, chrome.tabs.highlight({'tabs': tabId}, function(){});
I get this error:
Unchecked runtime.lastError while running tabs.highlight: No tab at index: 7355.
+3
drew hintz
source
to share
2 answers
chrome.tabs.highlight requires a tab index, not a tabId. You can convert the tabId to index using chrome.tabs.get:
chrome.tabs.get(tabId, function(tab) {
chrome.tabs.highlight({'tabs': tab.index}, function() {});
});
+5
drew hintz
source
to share
This function does not accept tab IDs, but instead tab indices (positions in the window)
+1
Xan
source
to share