WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

WebResourceRequested on different resources is invoked after navigating to a different page

Open nirdil opened this issue 3 years ago • 5 comments

While navigating back and forth between different pages with the WebView, sometimes WebResourceRequested is called with resource requests that are from a previous page.

AB#42274384

nirdil avatar Oct 26 '22 19:10 nirdil

If such calls can't be cancelled or filtered out by the API, I suggest at least adding the relevant NavigationId to the CoreWebView2WebResourceRequestedEventArgs class (similar to the classes CoreWebView2ContentLoadingEventArgs, CoreWebView2DOMContentLoadedEventArgs, etc.) so that resource requests can be distinguishable to their corresponding navigation source.

nirdil avatar Oct 26 '22 19:10 nirdil

Hi @nirbil , I'd expect that some of the resources are refreshed on back-forward navigations and correspondingly additional WebResourceRequested events will fire and if navigating back/forward too rapidly, the app could receive events for resource requests even though the WebView2 navigated away from the page with that resource. We will look into being able to map the WebResourceRequest to a given navigation ID as a feature request. For reference, what is the specific scenario you are trying to achieve here?

yildirimcagri-msft avatar Nov 17 '22 07:11 yildirimcagri-msft

If I want to intercept all the resources of a specific page I couldn't do that because I can't distinguish between resources of different page loads.

nirdil avatar Nov 17 '22 07:11 nirdil

Hi @nirbil, could you please tell a bit more about what kind of application you're building, and the particular scenario you are trying to accomplish here? It would be particularly beneficial if you could share some example use cases. Thank you!

novac42 avatar Jun 13 '23 11:06 novac42

Was using it to identify if a certain page is accessing insecure resources. I don't have a need for this anymore, but it feels like an inconsistent behavior. I'd at least expect to get a navigationId, similar to other API calls.

nirdil avatar Jun 13 '23 16:06 nirdil