mercredi 3 janvier 2018

Pop-up Form is not opening in a android web view

I am making an android app to open a website in a web view. The website is working fine and I can easily navigate to different pages but the webview is not showing login form when the user clicks on the "log in" option. I have tried many things to fix it but I am not getting it. Plz help.

Website: http://ift.tt/2DZIep4

Web Activity.java

public class WebActivity extends AppCompatActivity {
private WebView webView;
private String url = "http://ift.tt/2DZIep4";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);

    webView = findViewById(R.id.Web_view);
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public void onReceivedSslError(final WebView webView, final SslErrorHandler handler, SslError error) {
            Log.d("CHECK", "onReceivedSslError");
            AlertDialog.Builder builder = new AlertDialog.Builder(WebActivity.this);
            AlertDialog alertDialog = builder.create();
            String message = "Certificate error.";
            switch (error.getPrimaryError()) {
                case SslError.SSL_UNTRUSTED:
                    message = "The certificate authority is not trusted.";
                    break;
                case SslError.SSL_EXPIRED:
                    message = "The certificate has expired.";
                    break;
                case SslError.SSL_IDMISMATCH:
                    message = "The certificate Hostname mismatch.";
                    break;
                case SslError.SSL_NOTYETVALID:
                    message = "The certificate is not yet valid.";
                    break;
            }
            message += " Do you want to continue anyway?";
            alertDialog.setTitle("SSL Certificate Error");
            alertDialog.setMessage(message);
            alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Log.d("CHECK", "Button ok pressed");
                    // Ignore SSL certificate errors
                    handler.proceed();
                }
            });
            alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Log.d("CHECK", "Button cancel pressed");
                    handler.cancel();
                }
            });
            alertDialog.show();
        }
    });

    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDatabaseEnabled(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setAllowFileAccess(true);

    webView.loadUrl(url);

}

}




Aucun commentaire:

Enregistrer un commentaire