MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2

Home Page:https://aka.ms/webview2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Problem/Bug]: GetResponseAsync in WebResourceResponseReceived does not return correct server response for PDFs

Clemani opened this issue · comments

What happened?

In my app i want to save PDF files for further processing.
Therefore i tried to use the GetResponseAsync method in the WebResourceResponseReceived Event.
The PDF is displaying in the browser, the response header has Content-Disposition: inline

This does not work, instead of the raw PDF file i get something like this:
<!doctype html><embed name='C94DE37DAD01327D46CF45E91B692B3F' style='position:absolute; left: 0; top: 0;'width='100%' height='100%' src='about:blank' type='application/pdf' internalid='C94DE37DAD01327D46CF45E91B692B3F'>

I would expect to get the raw server respone instead custom html with useless information.
"name" and "internalid" in the html which is constructed by webview2 does not help, there is no way to grab the file with this information, right?

I did not test, may be an issue with PNGs or other types as well.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

124.0.2478.67

SDK Version

1.0.2365.46

Framework

WinForms

Operating System

Windows 11

OS Version

No response

Repro steps

Go to a website which displays PDFs inline, Content-Disposition: inline
Call GetResponseAsync method in the WebResourceResponseReceived Event

Expected: raw PDF file stream
Actual behaviour: HTML page constructed by webview2

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