reCAPTCHA Not Rendering in Android Webview

Issue

I have an Android app that is redirected users to a webpage that contains a reCAPTCHA question. Previously, I was implementing this simply by opening a browser window, and directing the user there. Recently, I changed it to use a webview instead for a better user experience, but the problem is that now for some reason the reCAPTCHA question is not rendered on the page; everything else functions normally. Why would this be, and how might I fix it? I assume this must have something to do with accessing a different domain from the webview (www.google.com), but not sure how to configure things differently that it’s not an issue. Here is how I am setting up the Webview. Note that the overridden method is for handling some OAuth authorization process that can happen in this Webview. Even if I comment that out, I have the same problem.

        WebView myWebView  (WebView) findViewById(R.id.webview);
        myWebView.loadUrl(this.url);
        myWebView.setWebViewClient(new WebViewClient()
            {
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String url){
                Uri uri  Uri.parse(url);
                if (url ! null && uri.getScheme().equals(NNApplication.CALLBACK_SCHEME)) {
                    SharedPreferences shPref   getSharedPreferences("NN_PREFS", Activity.MODE_PRIVATE);
                    new OAuthAccessTokenTask(Authorization.this, consumer, provider, shPref).execute(uri);
                    webView.setVisibility(View.GONE);
                    finish();

                    return true;
                }else{
                    return false;
                }


            }

            @Override
            public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
                 handler.proceed() ;
                 }              
        }); 

Likewise, you can view the reCAPTCHA question at the URL below. I already checked, and it’s behaving the same between our development site and our live site:

https://www-dev.usanpn.org/user/register

Solution

Captcha requires javascript:

myWebView.getSettings().setJavaScriptEnabled(true);

Answered By – Simas

Leave a Comment