title: Android WebView.loadUrl() freezes the page after evaluating javascript?
body: <p>I'd like to modify loaded by Android <code>WebView</code> page with JS (in this example just show alert from JS):</p>
  
  <pre><code>private static final String script2 = "alert('hello world');";
  
  webView.setWebChromeClient(new WebChromeClient() {
          @Override
          public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
              Toast.makeText(MainActivity.this, "Alert from js:\n" + message, Toast.LENGTH_LONG).show();
              return true; // ANSWER found:should return false in order NOT to freeze
          }
      });
  
  webView.setWebViewClient(new WebViewClient() {
  
          @Override
          public void onPageFinished(WebView view, String url) {
              getSupportActionBar().setTitle("Finishing ");
              getSupportActionBar().setSubtitle(url);
  
              if (cbScript2.isChecked()) { // true
                  runScript(script2);
              }
  
              getSupportActionBar().setTitle("Finished");
          }
      });
  
  private void runScript(String script) {
      if (cbApi19.isChecked())  // true
          webView.evaluateJavascript(script, null);
      else
          webView.loadUrl("javascript:" + script);
  }
  </code></pre>
  
  <p>After evaluating javascript (using <code>evaluateJavascript</code> or <code>.loadUrl("javascript:" ...</code>) the page becomes unresponsive - it can't be scrolled or the links clicked.</p>
  
  <p>According to the <a href="https://developer.android.com/reference/android/webkit/WebView.html#evaluateJavascript(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)" rel="nofollow">docs</a>: <code>evaluateJavascript</code></p>
  
  <blockquote>
    <p>Asynchronously evaluates JavaScript in the context of the currently displayed page.</p>
  </blockquote>
  
  <p>Why does it freeze the page? Can i execute my JS without any affect on the page behaviour?</p>