我无法使用 WebView Android 访问部署在 tomcat 中的本地 Web 应用程序

发布于 2024-11-09 07:22:07 字数 198 浏览 1 评论 0原文

是否可以使用WebView打开本地部署在tomcat中的Web应用程序?

我尝试使用

webView.loadUrl("https://me.com/myproj/mobile/online/overview.do");

,但得到的是空白页。有什么想法如何解决这个问题吗?

Is it possible to open a web app locally deployed in tomcat using WebView?

I tried using

webView.loadUrl("https://me.com/myproj/mobile/online/overview.do");

but I am getting a blank page instead. Any ideas how to fix this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

澜川若宁 2024-11-16 07:22:07

您的问题是您正在尝试访问 https 地址。

似乎如果您正在为 2.2+ 进行开发,那么有一个简单的解决方案:

engine = (WebView) findViewById(R.id.my_webview);
engine.setWebViewClient(new WebViewClient() {
    public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed() ;
    }
}

但如果您正在为旧版本进行开发,那么您就会遇到问题,因为该函数是从 Froyo 输入 API 的。

参考文献:

Your problem is that you're trying to access a https address.

It seems that if you're developing for 2.2+ there's a simple solution:

engine = (WebView) findViewById(R.id.my_webview);
engine.setWebViewClient(new WebViewClient() {
    public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed() ;
    }
}

But if you're developing for older versions, then you have problems because that function entered the API from Froyo.

References:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文