Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rahullli opened this issue Nov 20, 2024 · 9 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@rahullli
Copy link

rahullli commented Nov 20, 2024

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 rahullli added the bug Something isn't working label Nov 20, 2024
@champnic champnic added the tracked We are tracking this work internally. label Nov 20, 2024
@champnic champnic self-assigned this Nov 20, 2024
@champnic
Copy link
Member

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

@jls28
Copy link

jls28 commented Nov 21, 2024

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.

@rahullli
Copy link
Author

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 .

@jls28
Copy link

jls28 commented Nov 21, 2024

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

@rahullli
Copy link
Author

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 .

@jls28
Copy link

jls28 commented Nov 21, 2024

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 ?

@rahullli
Copy link
Author

rahullli commented Nov 21, 2024

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 .

@jls28
Copy link

jls28 commented Nov 21, 2024

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.

@rahullli
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants