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
I'm trying to detect if a window (result of window.open(...)) contains a PDF.
When I create my WebView2 control, I add a WebResourceResponseReceived event handler, but it doesn't fire when the WebView2 finishes navigating (to the PDF or to another site)
I have found that the only wait to get it to fire is to cancel the initial navigation and navigate it myself via CoreWebView2::Navigate(...) (code below)
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
128.0.2739.67
SDK Version
1.0.2535.41
Framework
Winforms
Operating System
Windows 11
OS Version
22631.4037
Repro steps
If you open the WinForms sample and:
In BrowserForm.cs::WebView2Control_CoreWebView2InitializationCompleted, add this.webView2Control.CoreWebView2.NewWindowRequested += CoreWebView2_NewWindowRequested;
I have found that if I cancel the initial navigation and navigate it myself, it work fine. So in CoreWebView2_NewWindowRequested, add webView.CoreWebView2.NavigationStarting +=(sender2, e2) => CoreWebView2_NavigationStarting(webView, e2); and then add:
What happened?
I'm trying to detect if a window (result of
window.open(...)
) contains a PDF.When I create my WebView2 control, I add a
WebResourceResponseReceived
event handler, but it doesn't fire when the WebView2 finishes navigating (to the PDF or to another site)I have found that the only wait to get it to fire is to cancel the initial navigation and navigate it myself via
CoreWebView2::Navigate(...)
(code below)Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
128.0.2739.67
SDK Version
1.0.2535.41
Framework
Winforms
Operating System
Windows 11
OS Version
22631.4037
Repro steps
If you open the WinForms sample and:
In
BrowserForm.cs::WebView2Control_CoreWebView2InitializationCompleted
, addthis.webView2Control.CoreWebView2.NewWindowRequested += CoreWebView2_NewWindowRequested;
For PDFs specifically, you can open a PDF to, say, https://www.sos.state.tx.us/corp/status-example.pdf
I have found that if I cancel the initial navigation and navigate it myself, it work fine. So in
CoreWebView2_NewWindowRequested
, addwebView.CoreWebView2.NavigationStarting +=(sender2, e2) => CoreWebView2_NavigationStarting(webView, e2);
and then add:Then, the WebResourceResponseReceived handler fires and
loadingPDF
is true.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
The text was updated successfully, but these errors were encountered: