title: WebView - intercepting form submission with javascript enabled
body: <p>I have a problem intercepting form submission in WebView when javascript is enabled. I created a small example to demonstrate this problem.</p>
  
  <p><strong>test1.html</strong></p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;h1&gt;Test 1&lt;/h1&gt;
      &lt;form action="http://111.222.33.44/test/test2.html" method="get"&gt;
        &lt;input type="text" name="text1" /&gt;
        &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>TestActivity</strong></p>
  
  <pre><code>public class TestActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          WebView webView = (WebView) findViewById(R.id.webView);
          webView.getSettings().setJavaScriptEnabled(true);
  
          webView.setWebViewClient(new WebViewClient() {
              @Override
              public boolean shouldOverrideUrlLoading(WebView view, String url) {
                  Log.d("Test app", "Intercepted");
                  return true;
              }
  
          });
          webView.loadUrl("http://111.222.33.44/test/test1.html");
      }
  
  }
  </code></pre>
  
  <p>When I run this app on Android 4.x message "Intercepted" is printed when I click on submit button. When I run this app on Android 2.1 - 2.3.x the message is not printed.</p>
  
  <p>How can I intercept form submission on Android 2.1 - 2.3.x?</p>
  
  <p>Thank you.</p>