MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Feature]: Allow more control over the window that appears when a webpage uses window.open
@Lakshmisha-KS is already working on this.
Since May 26, 2025.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature/enhancement you need
When a webpage opens a new window using window.open, the WebView2 defaults to open a new window which it creates and handles, similar to in MS Edge. Developers can override this behaviour in the WebView2 so that they can provide their own behaviour. However, it would be really advantageous if we could just have some customisability over the default window, so that we don't have to create our own window from scratch just to change one thing or be subscribe to an event. At the moment it kind of feels like a rouge window that, despite technically being part of the developer's app, they have no control over.
Perhaps the NewWindowRequested args could give us a WebView2 object for the default window, or some other object we could use to interface with it?
This is the window I am referring to:
The scenario/use case where you would use this feature
Specifically, this came to mind as I have an app with a WebView2 in a WPF app which has TopMost set to true on the window which uses it, and when the webpage opens a new window, the new window appears behind the app's window due to it not inheriting TopMost. If I could control whether the external window was TopMost, or could detect when the window opens and disable TopMost on my window until the new window closes, that would fix this issue.
Of course, there could be plenty of use cases for this, such as customising the window, responding to certain events to enable custom behaviour, etc. without the need to create a new window manually (may as well reuse the one that is already created).
How important is this request to you?
Nice to have. There are other ways to tackle this, but having official API support would be beneficial.
Suggested implementation
No response
What does your app do? Is there a pending deadline for this request?
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.