title: Xamarin Forms WebView Load embedded in application site
body: <p>I have embedded site in my assembly:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public partial class MainPage : ContentPage
      {
          public MainPage()
          {
              InitializeComponent();
              WebView.Navigating += WebView_Navigating;
              var resourceName = Program.GetResourceName("index.html");
              WebView.Source = new UrlWebViewSource()
              {
                  Url = "file://" + resourceName,
              };
          }
  
          public void WebView_Navigating(object sender, WebNavigatingEventArgs args)
          {
              if (args.Url.StartsWith("file://"))
              {
                  return;
              }
  
              Device.OpenUri(new Uri(args.Url));
  
              args.Cancel = true;
          }
      }
  </code></pre>
  
  <p>I have tried to figure out how to run it using <code>WebView</code> using <code>Xamarin.Forms</code> ...
  I have got embedded resource from my assembly and I need somehow to load text based html into WebView ...</p>
  
  <p>But I did not know how to do this ...
  Is there some API for loading Embedded Resource into WebView ?</p>
  
  <p>After some research I have found some solution:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using BlazorXamarinMobile.Web.Client;
  using Xamarin.Forms;
  using Xamarin.Forms.Xaml;
  
  namespace BlazorXamarinMobile
  {
      public partial class MainPage : ContentPage
      {
          Dictionary&lt;string, string&gt; _urlToHtml = new Dictionary&lt;string, string&gt;();
          public MainPage()
          {
              InitializeComponent();
              WebView.Navigating += WebView_Navigating;
              (string embeddedResource, string text) = Program.GetResourceName("index.html");
              embeddedResource = embeddedResource.Replace("wwwroot.index.html", "wwwroot/index.html");
              var embeddedResourceUrl = "file://" + embeddedResource;
              _urlToHtml.Add("file://BlazorXamarinMobile.Web.Client.wwwroot/".ToLower(), text);
              _urlToHtml.Add(embeddedResourceUrl.ToLower(), text);
              WebView.Source = new HtmlWebViewSource()
              {
                  BaseUrl = "file://BlazorXamarinMobile.Web.Client.wwwroot/".ToLower(),
                  Html = text,
              };
          }
  
          public void WebView_Navigating(object sender, WebNavigatingEventArgs args)
          {
              if (args.Url.StartsWith("file://"))
              {
                  if (args.Url.Contains("wwwroot/"))
                  {
                      var html = _urlToHtml[args.Url];
                      WebView.Source = new HtmlWebViewSource()
                      {
                          Html = html,
                      };
                  }
                  return;
              }
  
              args.Cancel = true;
          }
      }
  }
  </code></pre>
  
  <p>But WebView shows that Url is invalid !!
  But if I load text directly it shows initial site and error to Reload application ... It happens due to that WebView tries to load from custom path files, but those files are inside of Assembly and it should be loaded manually with some kind of hook ...</p>
  
  <p>Is it possible to do ?</p>