Android的web视图里面显示身份验证对话框 [英] Show authentication dialog inside webview android

查看:193
本文介绍了Android的web视图里面显示身份验证对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网址,这个网址打开验证对话框类似,当您试图访问你的路由器的路由器的后台管理页面。
在我的情况在WebView中载入URL当它外面也应用程序并打开Android原生网页浏览器,并显示该对话框。
我希望把它留在我作进一步处理的应用程序。

i have an URL, this url open the authentication dialog similar when you try to access the router admin page of your router. In my case when in load url in webview it goes outside may application and open android native web brower and display the dialog. i want to make it remain in my application for further processing.

就像网页浏览器开放路线的认证页面。

Just as the Web Brower open route's authentication page.

推荐答案

更新的定义你的的WebView 来的:

browser = (WebView) findViewById(R.id.wvBrowser);
WebSettings webSettings = browser.getSettings();
webSettings.setJavaScriptEnabled(true); // in case you are using javascript
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); 
browser.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return false;
    }
});

然后将网页视图能够创建多个页面,并在本机浏览器无法加载新的。

Then the WebView will be able to create many pages, and not load new ones in the native browser.

这篇关于Android的web视图里面显示身份验证对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆