title: Javascript is not working in webView when Loaded from asset folder but working from both http server & localhost
body: <p>I am trying to load <code>offline version of python documentation</code> into an <code>webview</code> from <code>asset</code>folder. The offline docs work perfectly in my pc web browser in offline but not working properly in <code>webview</code> (something like <code>jquery is missing</code>).</p>
  
  <pre><code>@SuppressLint("SetJavaScriptEnabled")
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          WebView webView = (WebView) findViewById(R.id.wrapper);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.setWebChromeClient(new WebChromeClient());
          webView.loadUrl("file:///android_asset/python/index.html");
      }
  
  }
  </code></pre>
  
  <p>And this error message is shown when I tried to load the home page or navigate to any page.</p>
  
  <pre><code>09-24 01:03:02.789: E/Web Console(479): ReferenceError: Can't find variable: $ at file:///android_asset/python/index.html:164
  </code></pre>
  
  <p>And the above error is for a Jquery code snippet ( I think this for that the jquery library isn't loading)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;$('#searchbox').show(0);&lt;/script&gt;
  </code></pre>
  
  <p>But when I load those pages from my local server <code>localhost</code> or <code>http</code> server, this is working perfectly. What did I miss? </p>
  
  <p><strong>Edit</strong>
  Showing nothing in the <code>webView</code>. After using <code>loadDataWithBaseURL</code>:</p>
  
  <pre><code>@SuppressLint("SetJavaScriptEnabled")
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          WebView webView = (WebView) findViewById(R.id.wrapper);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.setWebChromeClient(new WebChromeClient());
          AssetManager assetManager = getAssets();
          String htmlPage = null;
          InputStream input;
          try {
              input = assetManager.open("python/index.html");
  
              int size = input.available();
              byte[] buffer = new byte[size];
              input.read(buffer);
              input.close();
              // byte buffer into a string
              htmlPage = new String(buffer);
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
              webView.loadDataWithBaseURL("file:///android_asset/", htmlPage, "text/html", "utf-8", "");
  
      }
  }
  </code></pre>