WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

How to ensure settings like AreDevToolsEnabled, AreDefaultContextMenusEnabled are available to popup windows as well

Open santoshsampath opened this issue 4 years ago • 4 comments

If NewWindowRequested event is not registered then a popup opens automatically. However settings like AreDevTools enabled are not preserved.

The app can register for NewWindowRequested event and ensure correct settings are in place.

But the default pop-up handling is great, especially the read only address bar at the top which lets user know they are navigating to an external website from the app, websites certificate, permissions etc. An app creating its own window would not be able to emulate all the behavior of the popup easily.

Is there a way to control popup window's corewebview2 settings or an option to propagate same settings to popup windows?

AB#33900757

santoshsampath avatar Jun 16 '21 05:06 santoshsampath

Hey @santoshsampath - unfortunately this isn't possible today. You could build your own UI to display in a new window to recreate some of what the default popup experience has. I can also change this to be a Feature Request if you'd like me to - I think this sounds like a reasonable scenario that should be possible. Thanks!

champnic avatar Jun 21 '21 23:06 champnic

Thanks for the reply. Yes that would be great, it makes it easier for devs who only need to open links without too much of extra window handling.

santoshsampath avatar Jun 22 '21 04:06 santoshsampath

I've opened this as a scenario on our backlog - thanks!

champnic avatar Jun 22 '21 16:06 champnic

We are interested in this too, because we definitely do not want to see the user being able to mess with the DevTools within our app. We generally handle the NewWindowRequested event so that default popup windows aren't even allowed to open in the first place, however, there are quite a few known bugs in WebView2 (see #3268, #3354) and past bugs (not disabled Ctrl+U for Source View), which allow the user to still get such a popup window, so it would be nice if we could at least harden it.

IMFJS avatar Aug 21 '24 15:08 IMFJS