javascript - How to force focus a browser window using browser extensionplugin? - Stack Overflow

admin2025-04-21  0

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 e 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 es on top of other tabs, the browser window does not e on top of other browser windows.

I wonder if such API is available?

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 e 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 es on top of other tabs, the browser window does not e on top of other browser windows.

I wonder if such API is available?

Share Improve this question asked Sep 27, 2013 at 1:34 JoonJoon 9,9248 gold badges51 silver badges75 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Yes, in Firefox you have BrowserWindow.activate().

In Chrome you have chrome.windows.update(windowId, {focused: true})

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745171767a288699.html

最新回复(0)