title: Android WebView not loading Javascript on error
body: <p>I have a Android WebView loading a page with Javascript(AngularJS) code.  The page with Javascript code does not display at all except the circular progress bar is showing.  On Logcat I see this error:</p>
  
  <pre><code>I/chromium: [INFO:CONSOLE(117)] "TypeError: Cannot read property 'length' of undefined
  </code></pre>
  
  <p>Is there a way to handle this error and still get the page to load?  It's working on desktop Chrome browser where the page is loading fine.</p>
  
  <p>Currently, I have done the following on my webView instance:</p>
  
  <pre><code>   webView = (WebView) findViewById(R.id.web_view);
      webView.setWebViewClient(webViewClient);
      webView.setWebChromeClient(webChromeClient);
      webView.getSettings().setJavaScriptEnabled(true);
      webView.getSettings().setDomStorageEnabled(true);
  
  private class MyWebViewClient extends WebViewClient {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
          Log.i(getClass().toString(), "loading link in self");
          return true;
      }
  
      public void onPageFinished(WebView view, String url) {
          Log.i(getClass().toString(), " page finished");
          progressBar.setVisibility(View.GONE);
      }
  
      @Override
      public void onLoadResource(WebView view, String url) {
          if(url.startsWith("http://example.org/pdflinks")) {
              Log.i(getClass().toString(), "loading in Google PDF viewer url: " + url);
              loadPdfItem(url);
          }
      }
  
      @Override
      public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
          Log.e(getClass().toString(), "error: " + error);
          Toast.makeText(getApplicationContext(), "Error: " + error, Toast.LENGTH_LONG).show();
          //super.onReceivedError(view, request, error);
      }
  
      @Override
      public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
          Log.e(getClass().toString(), "received http error: " + errorResponse);
          Toast.makeText(getApplicationContext(), "Error: " + errorResponse, Toast.LENGTH_LONG).show();
          //super.onReceivedHttpError(view, request, errorResponse);
      }
  }
  
  class MyWebChromClient extends WebChromeClient {
      @Override
      public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
          Log.i(getClass().toString(), "console.message: " + consoleMessage.message());
          return false;
          //return super.onConsoleMessage(consoleMessage);
      }
  
  }
  </code></pre>
  
  <p>thanks for any insight.</p>