I am writing browser extensions for both chrome and firefox, and I am having a trouble finding how to focus a browser window that is currently out of focus but contains a tab that I want to focus.
Focusing a tab can be done when the browser window has focus. However, the browser window does not come to focus when I focus a tab inside it.
To make it clearer,
I have two chrome browser windows open, each containing multiple tabs. One of the window has a focus, and the other window contains a tab that I want to focus and show to the user. Though I can focus the tab so that it comes on top of other tabs, the browser window does not come on top of other browser windows.
I wonder if such API is available?
Yes, in Firefox you have BrowserWindow.activate()
.
In Chrome you have chrome.windows.update(windowId, {focused: true})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With