Android WebView 未从 https 网站加载验证码图像

use*_*156 1 browser ssl android webview

我正在开发一个需要我加载第三方网站的 Android 应用程序https://mmmoffice.com/。我正在使用 webview 加载这个 URL,我面临的问题是,这个网页的验证码图像没有显示。如果我从普通的 android 浏览器、google chrome 浏览器、firefox 浏览器或 UC 浏览器打开相同的 URL,它们都运行良好,并显示验证码图像。但它没有显示在我的网页视图中。请我需要帮助。我已经阅读了很多关于 stackoverflow 和 google 的文章,但都没有帮助。下面是我的代码:

WebView webView = (WebView)findViewById(R.id.webMain);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://mmmoffice.com");
Run Code Online (Sandbox Code Playgroud)

Gue*_*gon 7

我用你的代码创建了一个项目来检查你的问题。你得到

 I/chromium: [INFO:CONSOLE(3)] "Uncaught TypeError: Cannot read property 'each' of null", source: https://ajax.cloudflare.com/cdn-cgi/nexp/dok3v=088620b277/cloudflare.min.js (3)
 I/chromium: [INFO:CONSOLE(5)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://mmmoffice.com/js/storage.js?v=1 (5)
Run Code Online (Sandbox Code Playgroud)

当 webview 尝试加载验证码时。

只需添加settings.setDomStorageEnabled(true);. 您的最终代码应如下所示:

    WebView webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    WebSettings settings = webView.getSettings();
    settings.setDomStorageEnabled(true);
    webView.loadUrl("https://mmmoffice.com/");
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!!