Webview2 catch a request for: ?

vmars316 621 Reputation points
2022-05-09T15:34:14.113+00:00

TIA , I am working on a KidSafeBrowser
https://sourceforge.net/projects/kidsafebrowser-us/
where I catch this request in NavigationStarting ; (users can only visit sites that are Pre-Approved and stored in an Approved-Links-File) .

But problem is if user does a 'search' or 'clicks on a link' .
I am unable to catch that in NavigationStarting .

How/where can I catch that request ?

NavigationStarting
SourceChanged
ContentLoading
HistoryChanged
BasicAuthenticationRequested
DOMContentLoaded
NavigationCompleted

Thanks for your Help...

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,229 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XuDong Peng-MSFT 10,341 Reputation points Microsoft Vendor
    2022-05-10T04:10:32.467+00:00

    Hi @vmars316 ,

    If you need to get the request in the webView2 control, you can try to use CoreWebView2.WebResourceRequested Event to implement this requirement.

    And this must add at least one filter to raise the event, in the request class object you can view its various properties such as Content , Headers, Method and Uri. For more details, you can refer to this doc: CoreWebView2WebResourceRequest Class.

    Regards,
    Xudong Peng


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments