从不调用onReceivedHttpAuthRequest

时间:2019-11-12 12:07:28

标签: android webview

在使用webview加载url之前,我需要登录,我已经设置了WebViewclient并使用了以下方法:onReceivedHttpAuthRequest来传递用户名和密码。但是在活动中再次要求输入用户名/密码,而不是加载目标

 WebView mywebview = (WebView) findViewById(R.id.webView);
        mywebview.setWebViewClient(new WebViewClient() {
            @Override
            public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
                super.onReceivedHttpAuthRequest(view, handler, host, realm);
                Log.d("onReceivedHttp","called");
                handler.proceed("****","****");
            }
        });
mywebview.loadUrl("****");

0 个答案:

没有答案