简体   繁体   中英

Is it possible to tell the browser not to focus (bring to front) the selected window from `getDisplayMedia`?

I am working on an application using getDisplayMedia . When the browser prompts me to share my screen/a window and I select a specific window to share, that window is now suddenly focused and in front of my other windows (in particular, in front of the browser window!). I tested this with Firefox and Chrome, each on Ubuntu and Windows 10. I used this page to test.

I personally find this behavior kind of unexpected and annoying. I also fear that the technically less-inclined users of my application get very confused by this. So I'd like the browser to stay focused even after selecting a window. Is it possible to change that behavior? I checked the MDN docs on getDisplayMedia but did not find anything regarding this. I also did not find any information about this elsewhere.

If it's not possible to adjust that behavior, I'd like to know: why? Is it a technical limitation? Is it a privacy/security feature to make it more clear to the user that this window is shared now? (Personally I don't really think it helps the user but OK.)

No, it is generally not possible to change this behavior, since it is intentional.

While this behavior is not mandated by any specification , most browsers today will push a just-shared window to front.

The rationale is the typical use case is someone presenting a document in a web conference call. In that context, the assumption is that since this is a user-initiated action (it requires a user gesture), the user intends to interact with the surface that they just shared.

In the past, browsers used to not do this, and users got confused about what was happening and about which window was being shared.

If you have a compelling use case where this is problematic, consider describing it in a new issue on the specification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM