MicrosoftEdge / MicrosoftEdge/WebView2Feedback
img tag source loading - stuck in pending network status
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
For reference - for a local folder index.html source in the webview2 control.
The img sources were coded something like:
<img src="../user/items/image1.png"/>
The network requests for img source would sit in 'Pending' for a long time, and then all calls for resources after about 10-20 seconds would load fine.
The resolution was to immediately map a virtual host name to the local folder after EnsureCoreWebView2Async and use proper address source.
await AppWebView.EnsureCoreWebView2Async(null);
AppWebView.CoreWebView2.SetVirtualHostNameToFolderMapping("SLG.user", slg.appPath + "user/items/", CoreWebView2HostResourceAccessKind.DenyCors);
<img src="https://SLG.user/image1.png"/>
The pending network status no longer occurs and images load immediately. I assume some initial handshake/connection for the control to the actual local folder path was taking some time. Whether this is a bug or not, I can't be sure - it is likely better practice to set up the virtual host name anyway.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with a local-folder index.html in a WebView2 control and reproduce the relative image source behavior described in the issue. Compare loading with the virtual host mapping and HTTPS image source shown in the report; done means determining whether the pending requests indicate a WebView2 bug or documenting the required setup and expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, html
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100