MicrosoftEdge / MicrosoftEdge/WebView2Feedback

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

Open
#4,530 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

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:

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebResourceResponseReceived event and GetResponseAsync repro described in the issue, using an inline PDF with Content-Disposition: inline. Compare the returned content with the expected raw PDF stream and determine whether the behavior is specific to PDF responses or affects other embedded resources.

Written by the indexing model from the issue text.

Assessment

Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.