About using chrome.windows.update api at background can't work sometime.
⚠️ This is for issues with the https://developer.chrome.com site, not Chromium itself. If you want to file a bug with Chromium (the open-source project behind Google Chrome and other browsers), please use https://crbug.com.
Describe the bug I used the chrome.windows.update(windowId, {focused: true}) in my chrome extension at background.js, but it can't work when chrome is not the focused window. I use it by receive websocket message from my electron application, when received a websocket message from my electron application, i want to make my chrome window bring to front and focused by using chrome.windows.update(windowId, {active: true}) at background.js.
However, I am currently unable to bring the window containing the tab to the foreground and into a focused state. Why is this happening? It happend in most time, but it also didn't happen in some time, i cant find a pattern in which this event occurs.
To Reproduce Steps to reproduce the behavior:
- I have a Chrome extension called “TabHelper” and an Electron application called “URLOpener”.
- I created a WebSocket Server in URLOpener and a WebSocket Client in TabHelper. The logic in TabHelper is to establish a WebSocket connection with the WebSocket Server in URLOpener when the browser is opened.
- I send a message containing a URL to the WebSocket client in TabHelper using the WebSocket Server.
- when received the websocket message, i will create a tab with the URL by chrome.tabs.create(url, {active: true}) and bring the window to the foreground using the Chrome extensions API: chrome.windows.update(windowId, {focused: true}).
Expected behavior In step 4, the chrome window need bring to front and focused, but it not, it performance like the drawAttention feature at chrome.windows.update(windowId, {drawAttention: true}).
Screenshots
Desktop (please complete the following information):
- OS: windows 10 professional
- Browser: chrome
- Application: electron
- Version: chrome - 70/87/108, electron - 10.1.5
Smartphone (please complete the following information):
- Device: none
- OS: none
- Browser none
- Version none
Additional context Add any other context about the problem here.
@AmySteam Can anyone give any suggestion or any information to me please?
@SkyLightIn Thanks for following up. Let me try to find out.
@oliverdunk Do you have any insights on this? Thanks! :)
Hi @SkyLightIn, this looks like a known issue in Windows 10: https://crbug.com/1100790. Unfortunately, that bug is private - it would be great if you're able to open a public one. I'm going to close this in the meantime since the issues here are for our documentation, not bug tracking. You're welcome to use the channels at https://developer.chrome.com/docs/extensions/gethelp/ for any additional questions.