question

VernonMarsden-2934 avatar image
0 Votes"
VernonMarsden-2934 asked XuDongPeng-MSFT answered

Webview2 catch a request for: ?

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...

ms-edge
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

XuDongPeng-MSFT avatar image
0 Votes"
XuDongPeng-MSFT answered

Hi @VernonMarsden-2934,

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.