You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I open a pdf file on webview 2, I want to block users from using Ctrl + P to print. The OnKeyDown event doesn't recognize the P key so I can't intercept it
Importance
Blocking. My app's basic functions are not working due to this issue.
@thanhbao1996 are you referring to javascript onkeydown event or winforms keydown event? For javascript I am seeing p, o, and i onkeydown events even when preceded by 'ctrl.'
For .NET WebView2 controls, accelerator key combinations should trigger KeyDown event, so you should listen to that and suppress from there. I'm seeing that I can suppress Ctrl+O combination by doing this. However, I'm seeing Ctrl+P is not working for some reason.
For that I will file a bug on our side and track this issue,
@johna-ms Just as you mentioned, I am using the .NET WebView2 controls version and I am using the KeyDown event of the control. I also tried again, and when I press the 'o' key and set a breakpoint at the KeyDown event, it still does not respond.
Make sure you are doing it on the content of the PDF file.
@thanhbao1996 for .NET WebView2 it is expected that most keyboard events will not trigger the control's KeyDown/KeyUp handlers. Those will only respond to certain accelerator key presses. The way to get normal key events to work with the .NET control is to add a javascript onkeydown listener and use WebMessage to communicate that to the control
What happened?
When I open a pdf file on webview 2, I want to block users from using Ctrl + P to print. The OnKeyDown event doesn't recognize the P key so I can't intercept it
Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)
Runtime Version
126.0.25.92.102
SDK Version
No response
Framework
Winforms
Operating System
Windows 10
OS Version
Enterprise LTSC 1809
Repro steps
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#53007917
The text was updated successfully, but these errors were encountered: