MicrosoftEdge/WebView2Feedback

[Problem/Bug]: On Share , new window is opened , but event not coming on newWindowRequested

rahullli opened this issue · 9 comments

What happened?

image image

I am trying to share the URL , so it is opening in a new Window , but there is no event on the newWindowRequested
This is the code I am using
WebView.CoreWebView2.NewWindowRequested += CoreWebView2_NewWindowRequested;

So what I want is , I should get that event on the newWindowRequested event handler such that I can prevent it from opening in the new window.

cc : @JosephJin0815 , @champnic , @yild

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

Open URL in webview
On right clicking , click on share
It should raise an event on this event handler newWindowRequested.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

AB#55158496

Thanks for the bug report @rahullli - I've added this bug to our internal tracker. It does seem like this should be triggering the New Window event

I don't understand the question,

when I click on the share menu item,

this open a special windows,
and I don't think this is a web page with an url,
so it cannot have a NewWindowRequested event.

(runtime last 129.xxxxxxxx) / Win10.

I don't understand the question,

when I click on the share menu item,

this open a special windows, and I don't think this is a web page with an url, so it cannot have a NewWindowRequested event.

(runtime last 129.xxxxxxxx) / Win10.

So basically , I need to stop opening these special windows , as there is no event coming on the NewWindowRequested , I want to know from where exactly this window is opening , such that I can prevent it.
This Special window is being opened from the inspect and also from the share menu item .

what you can do is to remove the "Share" menu item, it is quite possible.

what you can do is to remove the "Share" menu item, it is quite possible.

Yeah its one way , but I don't want to remove menu items which are opening these new window .

If you don't want remove the menu item I don't understand what you want

disable menu item ?

perform another thing if the user use this menu item ?

If you don't want remove the menu item I don't understand what you want

disable menu item ?

perform another thing if the user use this menu item ?

I want the user to use menu Items functionality such as Share and Inspect , but as they are opening a new window , I want to open it in the same window , that's what I am looking for .

Ok, I don't think it is possible.
newWindowRequested is when a web link is requested to be open in a new window,
or when a javascript window.open(url, '_blank'...) is called.

Yeah , looking for the webview team to confirm if there exist any event handler for the same.