1

As title states ^

In these docs, there's a lot of support for working with tabs.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs

Including moving tabs around, deleting them, duplicating, reloading, executing javascript in the tab, etc. But I don't see anything that allows me to focus a given a tab.

Am I missing something?

Filip Kilibarda
  • 2,484
  • 2
  • 20
  • 31

2 Answers2

1

tabs.update(tabId, {highlighted:true})

Filip Kilibarda
  • 2,484
  • 2
  • 20
  • 31
0
browser.tabs.update(tabId, { active: true })

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/update

Setting highlighted to true will not necessarily switch tabs. For example, a tab already highlighted in Firefox will not become the active tab.

highlighted (optional):

boolean. Adds or removes the tab from the current selection. If true and the tab is not highlighted, it will become active by default.

If you only want to highlight the tab without activating it, Firefox accepts setting highlighted to true and active to false. Other browsers may activate the tab even in this case.

ban_javascript
  • 339
  • 1
  • 4
  • 16