0

I'm using WebView2 component for a hybrid app, and I've disabled the accelerator keys that show the DevTool window.

Unfortunately there is still the 'CTRL-U' hotkey that shows the source code of the page.

Is there a way to disable it?

Atropo
  • 309
  • 1
  • 9
  • Does this answer your question? [Disable Devtools in Microsoft.Web.WebView2.Wpf component](https://stackoverflow.com/questions/65428492/disable-devtools-in-microsoft-web-webview2-wpf-component) – Poul Bak Nov 26 '21 at 15:35
  • Well, it's not what I asked for... `AreDefaultContextMenusEnabled` and `AreDevToolsEnabled` only prevent from opening the DevTools window by the user, but the hot-key `CTRL-U` is still available – Atropo Dec 01 '21 at 08:28

1 Answers1

2

Found it!

In CoreWebView2Settings there is a property AreBrowserAcceleratorKeysEnabled that disables all "low level" hotkeys (also DevTools ones).

Just my opinion, but I find these settings counter-intuitive; I mean, I can disable DevTools with the property AreDevToolsEnabled (which removes both the entry in the context menu and the relative hotkeys), but yet programmatically invocable, and then there is also the AreBrowserAcceleratorKeysEnabled which disables every hotkeys (with the exception to text editing actions), but keeping the entry in the context menu for the DevTools.

Atropo
  • 309
  • 1
  • 9