How to ensure settings like AreDevToolsEnabled, AreDefaultContextMenusEnabled are available to popup windows as well
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?
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!
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.
I've opened this as a scenario on our backlog - thanks!
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.