Switch current tab from notification in Google Chrome extension
Not sure, but could you try adding a content script in an inactive tab (or just in all tabs), then sending a request to a non-active tab (sendRequest
)? The content script should execute window.focus()
. Again, not sure whether this works.
Update the inactive tab, and pass { selected: true }
. That should work, since it's listed as an available setting there.
Use active:true
to switch to tab/focus it, and highlighted:true
to select one or many like when you wanna move them around.
You can make a tab selected with:
chrome.tabs.update(tabId, {highlighted: true});
Chrome API is available inside notification html, so you can call any chrome.*
method you like.