MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Contents returned by document.body.innerText for raw JSON have changed

Open
#3,560 8 comments 1 reaction 1 assignee View on GitHub

@david-risney is already working on this.

Since Jun 13, 2023.

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

Description

Description
The handling of raw content (application/json and application/hal+json) has changed, which breaks our existing integration for situations where endpoints return raw content instead on HTML.

Version
SDK: 1.0.1823.32
Runtime: Edge Canary, 116.0.0.0
Framework: Win32
OS: Win10, Win11

Repro Steps

  1. Load JSON content into browser [https://jsonplaceholder.typicode.com/posts/1](https://jsonplaceholder.typicode.com/posts/1)
  2. Open DevTool Console
  3. Execute: document.body.innerText

WebView2 Runtime 114.* and earlier:
Raw JSON

Webview2/Edge Canary 116.*:
Some mangled version of the content.

image

Additional context
Note that response.body.textContent still return the original JSON, but also include trailing mangled content.

Also note that script injection workarounds fail since fetch is not allowed:
image

Possible workaround
Initial experimenting indicate this snippet as a possible workaround document.body.innerText.substr(document.body.innerText.indexOf('{')).

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.