我的 URL 使用 Cordova 从 HTTPS 转换为 HTTP
My URL is converted from HTTPS to HTTP using Cordova
在 cordova 中,我有一个 link 打开 HTTPS url。
<a href="https://example.com/">Click Here</a>
在 Chrome 开发者工具的“网络”选项卡中,我可以看到两条记录:
我的 https 请求 - 已取消
在没有 's' 的 HTTP 中相同 url - 被阻止。
为什么 Cordova 或 WebView 将我的 URL 从 HTTPS 转换为 HTTP?
URL 使用 Chrome 桌面进行测试,没有任何错误。
检查你的项目是否有白名单插件
cordova plugin ls
如果列表中没有显示白名单插件,则安装插件
cordova plugin add cordova-plugin-whitelist
cordova prepare
如果已经安装,则将此行添加到 config.xml 以允许访问所有请求。
<allow-navigation href="*" />
只允许访问 http 和 https。
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
如果问题仍然存在,请 post 您的 config.xml
希望这对您有所帮助。
在 cordova 中,我有一个 link 打开 HTTPS url。
<a href="https://example.com/">Click Here</a>
在 Chrome 开发者工具的“网络”选项卡中,我可以看到两条记录:
我的 https 请求 - 已取消
在没有 's' 的 HTTP 中相同 url - 被阻止。
为什么 Cordova 或 WebView 将我的 URL 从 HTTPS 转换为 HTTP?
URL 使用 Chrome 桌面进行测试,没有任何错误。
检查你的项目是否有白名单插件
cordova plugin ls
如果列表中没有显示白名单插件,则安装插件
cordova plugin add cordova-plugin-whitelist
cordova prepare
如果已经安装,则将此行添加到 config.xml 以允许访问所有请求。
<allow-navigation href="*" />
只允许访问 http 和 https。
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
如果问题仍然存在,请 post 您的 config.xml
希望这对您有所帮助。