【发布时间】:2023-02-24 05:40:13
【问题描述】:
如何在 http://localhost 而不是 https://localhost 上运行 cordova app webview?
我一直在使用 API 级别 (targetSdkVersion) 30 编译我的应用程序,据我所知,我的应用程序在内部通过 http 运行,因为对 http url 的所有 CORS 请求都工作正常。 现在,根据 Playstore 的要求,我正在使用 targetSdkVersion 31,我看到我的应用程序正在通过 https 运行,因此 webview 阻止了对 http 的 CORS 请求。
Mixed Content: The page at 'https://localhost/index.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www...com/ajax/get_domain.json.php'. This request has been blocked; the content must be served over HTTPS.
【问题讨论】:
-
将您的呼叫更新为 https?这里的问题是什么?
-
并非所有 CORS 请求都指向支持 https 的域,这就是问题所在
-
好吧,我不想成为那个人,但世界已经转向 https...Let's Encrypt 是免费的...
-
<preference name="Scheme" value="https" />
标签: cordova https mixed-content