MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Feature]: WebResourceRequested, but just for the main frame and only when we're waiting on the first response
@Lakshmisha-KS is already working on this.
Since Feb 12, 2025.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature/enhancement you need
related to this issue I opened
In Electron, I'd intercept onBeforeSendHeaders and send back some response headers for the initial navigation.
In WebView2, I'm using WebResourceRequested.
I add a filter on the document:
coreWebView2.AddWebResourceRequestedFilter(url + "*", CoreWebView2WebResourceContext.Document);
I add the "*" because the site might be redirected/load-balanced somewhere else.
However, this handler fires for every navigation, even for iframes.
Is there anyway to only run this for the main frame?
Additionally, I would only set these response headers when isWaitingForResponse return true. Is there a similar concept in WebView2 land?
The scenario/use case where you would use this feature
on main frame navigations, send up some response headers
How important is this request to you?
Impactful. My app's user experience would be significantly compromised without it.
Suggested implementation
My current solution is OK, but the logic is just running way to frequently (on every iframe navigation). I want to run it once when navigating the first time.
What does your app do? Is there a pending deadline for this request?
No response
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.
Assessment
This issue has not been assessed yet.