title: Xamarin : html page embeded in WebView doesn't execute js
body: <p>I have a new Android Xamarin Solution .
  I want to embed an HTML page that execute js script in a WebView.
  I added this html and this js page in  Android Assets.</p>
  <p><a href="https://i.stack.imgur.com/IDvKt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IDvKt.png" alt="enter image description here" /></a></p>
  <pre><code>MainPage.xaml
      &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;ContentPage xmlns=&quot;http://xamarin.com/schemas/2014/forms&quot;
               xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot;
               x:Class=&quot;App1.MainPage&quot;&gt;
  
      &lt;StackLayout&gt;
          &lt;Frame BackgroundColor=&quot;#2196F3&quot; Padding=&quot;24&quot; CornerRadius=&quot;0&quot;&gt;
              &lt;Label Text=&quot;Welcome to Xamarin.Forms!&quot; HorizontalTextAlignment=&quot;Center&quot; TextColor=&quot;White&quot; FontSize=&quot;36&quot;/&gt;
          &lt;/Frame&gt;
          &lt;Label Text=&quot;Start developing now&quot; FontSize=&quot;Title&quot; Padding=&quot;30,10,30,10&quot;/&gt;
          &lt;Label Text=&quot;Make changes to your XAML file and save to see your UI update in the running app with XAML Hot Reload. Give it a try!&quot; FontSize=&quot;16&quot; Padding=&quot;30,0,30,0&quot;/&gt;
          &lt;Label FontSize=&quot;16&quot; Padding=&quot;30,24,30,0&quot;&gt;
              &lt;Label.FormattedText&gt;
                  &lt;FormattedString&gt;
                      &lt;FormattedString.Spans&gt;
                          &lt;Span Text=&quot;Learn more at &quot;/&gt;
                          &lt;Span Text=&quot;https://aka.ms/xamarin-quickstart&quot; FontAttributes=&quot;Bold&quot;/&gt;
                      &lt;/FormattedString.Spans&gt;
                  &lt;/FormattedString&gt;
              &lt;/Label.FormattedText&gt;
          &lt;/Label&gt;
          &lt;WebView x:Name=&quot;webView&quot; WidthRequest=&quot;1000&quot; HeightRequest=&quot;1000&quot; /&gt;
      &lt;/StackLayout&gt;
  
  &lt;/ContentPage&gt;
  </code></pre>
  <p>MainPage.xaml.cs</p>
  <pre><code> using Xamarin.Forms;
      
      namespace App1
      {
          public partial class MainPage : ContentPage
          {
              public MainPage()
              {
                  InitializeComponent();
      
                  webView.Source = &quot;file:///android_asset/titi.html&quot;;
              }
          }
      }
  </code></pre>
  <p>titi.html</p>
  <pre><code> &lt;html&gt;
      &lt;body&gt;
          &lt;script src=&quot;http://code.jquery.com/jquery-2.1.4.min.js&quot;&gt;&lt;/script&gt;
      
          &lt;h1&gt;Webview Test&lt;/h1&gt;
          &lt;br /&gt;
          Enter name: &lt;input type=&quot;text&quot; id=&quot;name&quot;&gt;
          &lt;br /&gt;
          &lt;br /&gt;
          &lt;button type=&quot;button&quot; onclick=&quot;javascript: displayName($('#name').val());&quot;&gt;Test Button&lt;/button&gt;
          &lt;br /&gt;
          &lt;p id=&quot;result&quot;&gt;Result:&lt;/p&gt;
          &lt;script src=&quot;./titi.js&quot;&gt;&lt;/script&gt;
      
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  <p>titi.js</p>
  <pre><code>function displayName(str) {
      try {
          $('#result').text($('#result').text() + &quot; &quot; + str);
      
      }
      catch (err) {
          log(err);
      }
  }
  </code></pre>
  <p>The HTML page is correctly displayed but the js part is not executed when I click on button.</p>
  <p>Could you help me to unblock the situation please?</p>
  <p><a href="https://i.stack.imgur.com/P4XOl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P4XOl.png" alt="enter image description here" /></a></p>