WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

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

Open rahullli opened this issue 1 year ago • 11 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

rahullli avatar Nov 20 '24 11:11 rahullli

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

champnic avatar Nov 20 '24 19:11 champnic

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.

jls28 avatar Nov 21 '24 10:11 jls28

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 .

rahullli avatar Nov 21 '24 11:11 rahullli

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

jls28 avatar Nov 21 '24 11:11 jls28

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 .

rahullli avatar Nov 21 '24 12:11 rahullli

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 ?

jls28 avatar Nov 21 '24 12:11 jls28

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 .

rahullli avatar Nov 21 '24 12:11 rahullli

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.

jls28 avatar Nov 21 '24 12:11 jls28

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

rahullli avatar Nov 21 '24 13:11 rahullli

Hii @champnic , any update on this bug ? If possible , can you provide some estimate , by when this can be fixed or any other way to handle this ?

rahullli avatar Feb 14 '25 15:02 rahullli

Hi @champnic Any update on this Bug? If possible , can you provide some estimate , by when this can be fixed or any other way to handle this ?

rahullli avatar Mar 12 '25 11:03 rahullli