Hello,
Welcome to our Microsoft Q&A platform!
Problem is that I want to get original html
From WebView.EvaluateJavaScriptAsync(String) Method, we know that WebView includes the ability to invoke a JavaScript function from C#, and return any result to the calling C# code. For more details, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#invoking-javascript .
If you want to get original html, you can use the following code:
HtmlWebViewSource LoadHTMLFileFromResource()
{
var source = new HtmlWebViewSource();
// Load the HTML file embedded as a resource in the .NET Standard library
var assembly = typeof(EvaluateJavaScriptPage).GetTypeInfo().Assembly;
var stream = assembly.GetManifestResourceStream("WebViewSample.index.html");
using (var reader = new StreamReader(stream))
{
source.Html = reader.ReadToEnd();
}
return source;
}
You can refer to document: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#invoking-javascript
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
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.