title: How To Detect Redirects in Android Web view
body: <p>After several redirects the url finally ends up in Webform How can i Exit from the webview ? 
  Is There a way i can detect Html element in webview like button in the page. I cannot use Javascript here since i don't own the sites</p>
  
  <pre><code>public class ProductionWebView extends Activity{
  
  
      private WebView webView;
      String url ="https://www.google.lk/?gws_rd=ssl";
  
  
  
      @SuppressLint("JavascriptInterface")
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.production_webview);
          webView = (WebView) findViewById(R.id.webView1);
          webView.getSettings().setLoadsImagesAutomatically(true);
          webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
          webView.loadUrl(url);
  
          //ws.setJavaScriptEnabled(true);
          webView.addJavascriptInterface(new Object()
          {
            public void performClick()
            {
                // Deal with a click on the OK button
            }
          }, "Next");
          webView.addJavascriptInterface(new Object()
          {
  
            public void performClick()
            {
  
            }
          }, "Authorize");        
  
      }
  
  
  }
  </code></pre>