Flutter InAppWebView 图片资源加载失败

836 阅读1分钟

有问题的网页 :忽然发现家里很有钱是什么体验?-七猫作家交流区


测试发现资源加载不出来,发现是 http 请求, 然后开始查安卓webview http 资源加载不出来的问题

找到了这个issue github.com/pichillilor…

按照上面的配置试了一遍,没效果~~~~ 法克

再查怎么debug 安卓webview inappwebview.dev/docs/debugg…

打开 chrome://inspect/#devices 也TM 没效果

无奈,将 InAppWebViewcallback 都加上

onConsoleMessage: (controller, consoleMessage) {
  debugPrint('[webview][on onConsoleMessage] ${consoleMessage.toString()}');
}

有日志输出

{message: Mixed Content: The page at 'https://m-bbs.qimao.com/detail/5117' was loaded over HTTPS, but requested an insecure image 'http://p1.hoopchina.com.cn/bytedance/76f59847849d4e518ae2207af4914774_w_690_h_3014.jpeg?x-oss-process=image/resize,w_800/format,webp'. This request has been blocked; the content must be served over HTTPS., messageLevel: 3}

Mixed Content 的问题, 如下两个连接是解决这个问题的两个方法.

http - Is it possible to allow mixed content in Flutter WebView - Stack Overflow

错误:Mixed Content: The page at ‘https://XXX’ was loaded over HTTPS, but requested an insecure......._cczzyc1的博客-CSDN博客