gpt4 book ai didi

javascript - 将 Apache Thrift 与 Apache Cordova 相结合

转载 作者:行者123 更新时间:2023-11-28 06:03:35 26 4
gpt4 key购买 nike

我想知道是否有人成功地使用 Cordova 制作应用程序,然后使用 Thrift 发送 RPC 调用。我试图从我的手机在不同网络上向 C++ 服务器发送一个字符串,但由于 CORS 而不会。无论如何?

最佳答案

Cordova 和 Phonegap 不使用或强制执行 CORS。安全处理方式不同——使用白名单

这是你需要知道的。

来自 Top Mistakes by Developers new to Cordova/Phonegap你打了:

  • #10 不在 config.xml 中添加新的“白名单”和“白名单插件”参数。

对于#10

This relatively * NEW * requirement means – to access ANY website or resources on the web, you MUST use the whitelist and the whitelist plugin. This requirement goes into affect if you are using cordova-android@4.0.0 or better; including cli-5.1.1. If however, your version is before 4.0.0, let use say 3.5.0 or 3.7.0, then you will not have to add the white-list requirement.

To be clear, the "whitelist" has been around for a bit, but the plugin and requirement is very new. As you would expect, when the "whitelist" was added, the defacto open-access feature was deprecated. Or said another way, the defacto open-access feature was planned and scheduled to be eliminated. This change marks a step in removal of the open-access feature.

In addition, the Content Security Policy (CSP) has caught numerous developers - because it was soooo poorly publicized. This CSP needs to go in every single HTML page you used, just like you have to wait for 'deviceready'. The documentation is buried in the bottom of many of the latest documentation pages.

相关链接

Phonegap Build Forum: Notes for upgrading to cli-5.1.1 on PGB and now required Whitelist

关于javascript - 将 Apache Thrift 与 Apache Cordova 相结合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32815854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com