Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET MAUI webview view actual HTML

Is it possible to retrieve the HTML a .NET MAUI WebView is currently displaying?
If so, how?
Unfortunately, I can't find anything on it inside the official documentation.

.NET MAUI WebView documentation

I am trying to retrieve the currently displayed HTML as a string, after a JavaScript event changed the HTML body content, to read out some meta-data.

like image 781
Dokug Avatar asked Sep 05 '25 03:09

Dokug


1 Answers

I don't think you can access it directly (like with WebView2). However you can call Javascript, which have access to the HTML :

string result = await webView.EvaluateJavaScriptAsync($"document.documentElement.innerHTML");
like image 70
Poulpynator Avatar answered Sep 07 '25 21:09

Poulpynator