Load local resources (css, js, images) to WebView Source in Xamarin

Viewed 1194

I'm using Xamarin WebView to display some local html pages that are located under (FileSystem.AppDataDirectory) that is "C:/Users/nameUser/AppData/Local/Packages/....../LocalState/folder/file.html"
Under folder directory, beside the .html file there are other resources like .js and .css, and images.
I'm able to load html using a StreamReader and put the html code in a variable but I can't load the resource.

string html = "";
HtmlWebViewSource source = new HtmlWebViewSource();

string filePath = Path.Combine(folderPath, "index.html"); <br>
using (var sr = new StreamReader(filePath))<br>
{ <br>
     html = sr.ReadToEnd(); <br>
}<br>
source.Html = @html; <br>
source.BaseUrl = folderPath; //path that contains css and js resources <br> 
webView.Source = source;

So I'm able to view the Html code but I can't load the resources. Is there a way to solve this issues?

0 Answers
Related